From b71d471254ffec672e9cf3815372f79db3247f32 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sun, 5 Mar 2017 12:11:53 +0100 Subject: add created_at to participant --- queries/participant.sql | 3 +++ 1 file changed, 3 insertions(+) (limited to 'queries') diff --git a/queries/participant.sql b/queries/participant.sql index a65bdde..8b20858 100644 --- a/queries/participant.sql +++ b/queries/participant.sql @@ -1,7 +1,9 @@ WITH rosters AS (SELECT + (match.data->'data'->'attributes'->>'createdAt')::timestamp AS matchdate, JSONB_ARRAY_ELEMENTS(match.data->'relations') AS roster FROM match WHERE id=$1), participants AS (SELECT + matchdate, rosters.roster->'data'->>'id' AS rosterid, JSONB_ARRAY_ELEMENTS(rosters.roster->'relations') AS participant FROM rosters) @@ -10,6 +12,7 @@ SELECT participant->'data'->>'id' AS "api_id", rosterid AS "roster_api_id", participant->'relations'->0->'data'->>'id' AS "player_api_id", +matchdate AS "created_at", participant->'data'->'attributes'->>'actor' AS "hero", (participant->'data'->'attributes'->'stats'->>'assists')::int AS "assists", -- cgit v1.3.1