From 19a9bbbb5b44cce3411fd1452096b270d6441b13 Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 9 Nov 2019 11:18:04 +0100 Subject: Converting players database to baza2.csv format --- docs/convert-to-baza2.csv.sql | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/convert-to-baza2.csv.sql (limited to 'docs') diff --git a/docs/convert-to-baza2.csv.sql b/docs/convert-to-baza2.csv.sql new file mode 100644 index 0000000..1b62172 --- /dev/null +++ b/docs/convert-to-baza2.csv.sql @@ -0,0 +1,5 @@ +ALTER TABLE `players` + ADD COLUMN `gender` varchar(1) COLLATE utf8_unicode_520_ci NOT NULL + AFTER `region`; +UPDATE `players` SET `gender` = 'K', `flags` = SUBSTRING(`flags` FROM 2) WHERE flags LIKE 'K%'; +UPDATE `players` SET `gender` = 'M' WHERE gender = ''; -- cgit v1.2.3 From e401b88b24e25598dc488e080f4bf2200b45efdd Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 9 Nov 2019 11:32:08 +0100 Subject: Importing rankings compatible with baza2.csv format --- bin/rankings-csv-import.sh | 2 +- docs/convert-to-baza2.csv.sql | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/bin/rankings-csv-import.sh b/bin/rankings-csv-import.sh index 54ce6bc..9eddd82 100755 --- a/bin/rankings-csv-import.sh +++ b/bin/rankings-csv-import.sh @@ -7,7 +7,7 @@ REPLACE INTO TABLE temp_rankings FIELDS TERMINATED BY ','; INSERT INTO rankings ( - SELECT pid, \`date\`, place, score, region, flags, rank, club, 0 + SELECT pid, \`date\`, place, score, region, gender, flags, rank, club, 0 FROM temp_rankings JOIN players ON players.id = temp_rankings.pid diff --git a/docs/convert-to-baza2.csv.sql b/docs/convert-to-baza2.csv.sql index 1b62172..c6a5f22 100644 --- a/docs/convert-to-baza2.csv.sql +++ b/docs/convert-to-baza2.csv.sql @@ -3,3 +3,8 @@ ALTER TABLE `players` AFTER `region`; UPDATE `players` SET `gender` = 'K', `flags` = SUBSTRING(`flags` FROM 2) WHERE flags LIKE 'K%'; UPDATE `players` SET `gender` = 'M' WHERE gender = ''; +ALTER TABLE `rankings` + ADD COLUMN `gender` varchar(1) COLLATE utf8_unicode_520_ci NOT NULL + AFTER `region`; +UPDATE `rankings` SET `gender` = 'K', `flags` = SUBSTRING(`flags` FROM 2) WHERE flags LIKE 'K%'; +UPDATE `rankings` SET `gender` = 'M' WHERE gender = ''; -- cgit v1.2.3