From b03f611328c3a20792f4a9d857d5e4c6b6070a87 Mon Sep 17 00:00:00 2001 From: Tobias Ibounig Date: Tue, 6 Feb 2024 23:38:18 +0100 Subject: [PATCH] Player name fixup, github actions converts data to JSON --- .github/workflows/aligulac-import.yaml | 8 +++-- db_import/data-fixup.sql | 41 ++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/.github/workflows/aligulac-import.yaml b/.github/workflows/aligulac-import.yaml index 4224cc9..00518e6 100644 --- a/.github/workflows/aligulac-import.yaml +++ b/.github/workflows/aligulac-import.yaml @@ -22,7 +22,7 @@ jobs: steps: - name: Install postgres client - run: sudo apt-get install -y postgresql-client + run: sudo apt-get install -y postgresql-client yq - name: Postgres client version run: psql --version - name: Check out repository code @@ -35,8 +35,12 @@ jobs: run: PGPASSWORD=postgres psql -h localhost -p 5432 -d postgres -U postgres -f db_import/data-fixup.sql - name: Export player data run: PGPASSWORD=postgres psql -h localhost -p 5432 -d postgres -U postgres -t -A -F"," -f db_import/top500-earnings.sql > result.csv - - name: Display Result + - name: Display CSV run: cat result.csv + - name: Convert to JSON + run: yq result.csv -p=csv -o=json > players.json + - name: Display JSON + run: cat players.json #- name: Commit changes # run: | # git config --global user.name 'GH Action Bot' diff --git a/db_import/data-fixup.sql b/db_import/data-fixup.sql index 89e4bee..b45e0a2 100644 --- a/db_import/data-fixup.sql +++ b/db_import/data-fixup.sql @@ -1,5 +1,42 @@ BEGIN; +-- fix two Rain +UPDATE public.player +SET tag = 'Rain (P)' +WHERE player.id = 7; + +UPDATE public.player +SET tag = 'Rain (T)' +WHERE player.id = 104; + +-- fix two Happy +UPDATE public.player +SET tag = 'Happy (RU)' +WHERE player.id = 95; + +UPDATE public.player +SET tag = 'Happy (KR)' +WHERE player.id = 40; + +-- fix two Check +UPDATE public.player +SET tag = 'Check (1993)' +WHERE player.id = 1663; + +UPDATE public.player +SET tag = 'Check (1986)' +WHERE player.id = 166; + +-- fix two Bunny +UPDATE public.player +SET tag = 'Bunny (KR)' +WHERE player.id = 1517; + +UPDATE public.player +SET tag = 'Bunny (DK)' +WHERE player.id = 1813; + + -- fix MaxPax birthday (2004-07) -- https://liquipedia.net/starcraft2/MaxPax UPDATE public.player @@ -80,6 +117,4 @@ UPDATE public.player SET birthday = '1996-02-27' WHERE player.id = 2453; - - -COMMIT; \ No newline at end of file +COMMIT;