summaryrefslogtreecommitdiff
path: root/queries/participant.sql
diff options
context:
space:
mode:
authorKapil Viren Ahuja <kvahuja@users.noreply.github.com>2017-02-19 17:04:35 +0530
committerGitHub <noreply@github.com>2017-02-19 17:04:35 +0530
commit7eb07c0ccf2f464e3936b24136e41471ff1c1ff7 (patch)
treec117aecbc2276c875edd7a328f15ea872c1c8b64 /queries/participant.sql
parenteaf6b29760f13040444707eecf9c342c67bd6ffb (diff)
parentd940ad82f7e34576bf6cc6b8a93cbc298765315e (diff)
downloadshrinker-7eb07c0ccf2f464e3936b24136e41471ff1c1ff7.tar.gz
shrinker-7eb07c0ccf2f464e3936b24136e41471ff1c1ff7.zip
Merge pull request #14 from vainglorygame/features/web-db-model-refactoring
Features web db model refactoring
Diffstat (limited to 'queries/participant.sql')
-rw-r--r--queries/participant.sql28
1 files changed, 28 insertions, 0 deletions
diff --git a/queries/participant.sql b/queries/participant.sql
new file mode 100644
index 0000000..b7685a9
--- /dev/null
+++ b/queries/participant.sql
@@ -0,0 +1,28 @@
+SELECT
+
+id AS "apiId",
+relationships->'player'->'data'->>'id' AS "player_apiId",
+
+attributes->>'actor' AS "hero",
+(attributes->'stats'->>'assists')::int AS "assists",
+COALESCE(NULLIF(attributes->'stats'->>'crystalMineCaptures', ''), '0')::int AS "crystalMineCaptures",
+(attributes->'stats'->>'deaths')::int AS "deaths",
+(attributes->'stats'->>'farm')::float AS "farm",
+(attributes->'stats'->>'firstAfkTime')::float AS "firstAfkTime",
+COALESCE(NULLIF(attributes->'stats'->>'goldMineCaptures', ''), '0')::int AS "goldMineCaptures",
+COALESCE(NULLIF(attributes->'stats'->>'jungleKills', ''), '0')::int AS "jungleKills",
+COALESCE(NULLIF(attributes->'stats'->>'karmaLevel', ''), '0')::int AS "karmaLevel",
+COALESCE(NULLIF(attributes->'stats'->>'kills', ''), '0')::int AS "kills",
+COALESCE(NULLIF(attributes->'stats'->>'krakenCaptures', ''), '0')::int AS "krakenCaptures",
+COALESCE(NULLIF(attributes->'stats'->>'level', ''), '0')::int AS "level",
+COALESCE(NULLIF(attributes->'stats'->>'minionKills', ''), '0')::int AS "minionKills",
+COALESCE(NULLIF(attributes->'stats'->>'skillTier', ''), '0')::int AS "skillTier",
+COALESCE(NULLIF(attributes->'stats'->>'skinKey', ''), '0') AS "skinKey",
+(attributes->'stats'->>'wentAfk')::bool::bool AS "wentAfk",
+(attributes->'stats'->>'winner')::bool::bool AS "winner",
+attributes->'stats'->'itemGrants' AS "itemGrants",
+attributes->'stats'->'itemSells' AS "itemSells",
+attributes->'stats'->'itemUses' AS "itemUses",
+attributes->'stats'->'items' AS "items"
+
+FROM participant