Skip to content

Commit

Permalink
Merge pull request #20 from unipept/upgrade_db_scripts
Browse files Browse the repository at this point in the history
cleanup database upgrade scripts
  • Loading branch information
pverscha authored Jun 8, 2021
2 parents 48e24fe + 8c51db0 commit 9b81b21
Show file tree
Hide file tree
Showing 15 changed files with 426 additions and 35 deletions.
1 change: 0 additions & 1 deletion database/data.sql → database/misc/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ INSERT INTO `unipept`.`users` (`id`, `username`, `admin`) VALUES (2, 'pdawyndt',
INSERT INTO `unipept`.`users` (`id`, `username`, `admin`) VALUES (3, 'guest', 0);

COMMIT;

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 0 additions & 32 deletions database/swap_databases.sql

This file was deleted.

3 changes: 3 additions & 0 deletions database/upgrade/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This file contains all scripts, completely preconfigured, to upgrade the database on our Unipept production server. See
the main [Unipept wiki](https://github.com/unipept/unipept/wiki/Update-Unipept-database) for more information on how
to do this.
2 changes: 1 addition & 1 deletion database/index.sh → database/upgrade/index.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function print {
function doCmd {
echo -n "-> "
print "$1"
echo $1 | mysql -u unipept -punipept unipept 2>&1 | sed "s/^/ /" | grep -v "Using a password on the command line interface can be insecure" | tee -a $logfile
echo $1 | mysql -u unipept -punipept unipept2 2>&1 | sed "s/^/ /" | grep -v "Using a password on the command line interface can be insecure" | tee -a $logfile
}


Expand Down
7 changes: 6 additions & 1 deletion database/load.sh → database/upgrade/load.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
# extracts all .tsv.gz files, imports them into the unipept database
# and removes the files

db=unipept
# Directory from which the .tsv.gz files should be read and parsed (= first argument to this script).
dir="$1"
db=unipept2

function print {
echo $(date -u) $1
}

cd "$dir"

for file in *.tsv.gz
do
Expand All @@ -17,3 +20,5 @@ do
zcat $file | mysql --local-infile=1 -uunipept -punipept $db -e "LOAD DATA LOCAL INFILE '/dev/stdin' INTO TABLE $tbl;SHOW WARNINGS" 2>&1
done
print "done"

cd -
File renamed without changes.
Loading

0 comments on commit 9b81b21

Please sign in to comment.