diff --git a/proxy_docker/app/data/sqlmigrate20181213_0-0.1.sh b/proxy_docker/app/data/sqlmigrate20181213_0-0.1.sh index 7dce6ac..5de49f3 100644 --- a/proxy_docker/app/data/sqlmigrate20181213_0-0.1.sh +++ b/proxy_docker/app/data/sqlmigrate20181213_0-0.1.sh @@ -1,10 +1,13 @@ #!/bin/sh echo "Checking for OTS support in DB..." -sqlite3 db/proxydb ".tables" | grep "stamp" > /dev/null +sqlite3 $DB_FILE ".tables" | grep "stamp" > /dev/null if [ "$?" -eq "1" ]; then # stamp not there, we have to migrate echo "Migrating database for OTS support..." + echo "Backing up current DB..." + cp $DB_FILE $DB_FILE-sqlmigrate20181213_0-0.1 + echo "Altering DB..." cat sqlmigrate20181213_0-0.1.sql | sqlite3 $DB_FILE else echo "Database OTS support migration already done, skipping!" diff --git a/proxy_docker/app/data/sqlmigrate20190130_0.1-0.2.sh b/proxy_docker/app/data/sqlmigrate20190130_0.1-0.2.sh index 55d2c03..0c68e39 100644 --- a/proxy_docker/app/data/sqlmigrate20190130_0.1-0.2.sh +++ b/proxy_docker/app/data/sqlmigrate20190130_0.1-0.2.sh @@ -1,10 +1,13 @@ #!/bin/sh echo "Checking for watch by xpub support in DB..." -sqlite3 db/proxydb ".tables" | grep "watching_by_pub32" > /dev/null +sqlite3 $DB_FILE ".tables" | grep "watching_by_pub32" > /dev/null if [ "$?" -eq "1" ]; then # watching_by_pub32 not there, we have to migrate echo "Migrating database for watch by xpub support..." + echo "Backing up current DB..." + cp $DB_FILE $DB_FILE-sqlmigrate20190130_0.1-0.2 + echo "Altering DB..." cat sqlmigrate20190130_0.1-0.2.sql | sqlite3 $DB_FILE else echo "Database watch by xpub support migration already done, skipping!"