From d6d94e86c7b44c99dd6974453ba27637e8fb7196 Mon Sep 17 00:00:00 2001
From: schneefux <schneefux+commit@schneefux.xyz>
Date: Sat, 4 Mar 2017 11:33:46 +0100
Subject: update queries after column name case change

---
 queries/player/count_player_matches.sql | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

(limited to 'queries/player/count_player_matches.sql')

diff --git a/queries/player/count_player_matches.sql b/queries/player/count_player_matches.sql
index db5a2de..fbdd283 100644
--- a/queries/player/count_player_matches.sql
+++ b/queries/player/count_player_matches.sql
@@ -1,20 +1,20 @@
 with stats as (
 with plr as (
 select 
-    'a'::text as "patchVersion",
-    player."apiId" as player_api_id,
-    match."gameMode" as game_mode,
-    participant."winner" as winner
+    match.patch_version as patch_version,
+    player.api_id as player_api_id,
+    match.game_mode as game_mode,
+    participant.winner as winner
 from
     match, roster, participant, player
 where
-    match."apiId" = roster."match_apiId" and
-    roster."apiId" = participant."roster_apiId" and
-    participant."player_apiId" = player."apiId" and
-    player."apiId" = $1)
+    match.api_id = roster.match_api_id and
+    roster.api_id = participant.roster_api_id and
+    participant.player_api_id = player.api_id and
+    player.api_id = $1)
 select
     (select distinct(player_api_id) from plr),
-    (select distinct("patchVersion") as "patchVersion" from plr),
+    (select distinct(patch_version) from plr),
     (select count(*) as played from plr), 
     (select count(*) as wins from plr where winner = true), 
     (select count(*) as casual_played from plr where game_mode like '%casual%'),
@@ -23,5 +23,5 @@ select
     (select count(*) as ranked_wins from plr where game_mode like '%ranked%' and winner = true),
     (select 0 as streak)
 )
-INSERT INTO player_stats("player_apiId", "patchVersion", played, wins, casual_played, casual_wins, ranked_played, ranked_wins, streak)
+INSERT INTO player_stats(player_api_id, patch_version, played, wins, casual_played, casual_wins, ranked_played, ranked_wins, streak)
     SELECT * FROM stats
-- 
cgit v1.3.1

