From bcdb29305a18e4e2add7ce9c28fe481768bb5201 Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Mon, 27 Feb 2017 15:21:12 +0100
Subject: process roster's match_apiId

---
 queries/roster.sql | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'queries/roster.sql')

diff --git a/queries/roster.sql b/queries/roster.sql
index c61967b..2344c7f 100644
--- a/queries/roster.sql
+++ b/queries/roster.sql
@@ -1,8 +1,10 @@
 WITH rosters AS (SELECT
+  id AS matchid,
   JSONB_ARRAY_ELEMENTS(match.data->'relations') AS roster
 FROM match WHERE id=$1)
 SELECT
-roster->'data'->>'id' as "apiId",
+roster->'data'->>'id' AS "apiId",
+matchid AS "match_apiId",
 (roster->'data'->'attributes'->'stats'->>'acesEarned')::int AS "acesEarned",
 (roster->'data'->'attributes'->'stats'->>'gold')::int AS "gold",
 (roster->'data'->'attributes'->'stats'->>'heroKills')::int AS "heroKills",
-- 
cgit v1.3.1

