From 9e7e12006de38f46c08d5bba28691837a4a6be8d Mon Sep 17 00:00:00 2001 From: emkael Date: Sat, 29 May 2021 17:30:41 +0200 Subject: Players data import from Cezar to Players db --- dumps/import-players.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 dumps/import-players.sh (limited to 'dumps/import-players.sh') diff --git a/dumps/import-players.sh b/dumps/import-players.sh new file mode 100755 index 0000000..5f499ef --- /dev/null +++ b/dumps/import-players.sh @@ -0,0 +1,13 @@ +#!/bin/bash +cd $(dirname $0) +DBNAME=${LIGA_PLAYERS_DB_NAME} +curl 'https://msc.com.pl/cezar/download/baza.csv' | grep '^[0-9]' > baza.csv +mysql ${LIGA_MYSQL_CONNECTION_OPTS} --local-infile=1 $DBNAME -e "LOAD DATA LOCAL INFILE 'baza.csv' +REPLACE +INTO TABLE players +FIELDS TERMINATED BY ';' ENCLOSED BY '\"' +(ID, gname, sname, rank, loc1, info, loc2, flag1, flag2); +UPDATE players SET age = REPLACE(info, 'K', ''), sex = IF(POSITION('K' IN info), 'K', ''); +UPDATE players SET info = NULL; +" +rm baza.csv -- cgit v1.2.3