diff --git a/.configuration.sh~ b/.configuration.sh~ deleted file mode 100644 index ec43708..0000000 --- a/.configuration.sh~ +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# localhost -export PSQL_OPTS="-h localhost -U root" - -# Prod -#export PSQL_OPTS="-h PRODUCTION.SERVER.URL -U root" -#export DB_NAME=DATABASE_NAME diff --git a/.gitignore b/.gitignore index 625ee42..2e3a05f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .configuration.sh +env/*.conf diff --git a/db-upgrade b/db-upgrade index f74c824..c88a855 100755 --- a/db-upgrade +++ b/db-upgrade @@ -1,6 +1,12 @@ #!/bin/bash set -e -source .configuration.sh + +DB_ENVIRONMENT=$1 +if [ -z $DB_ENVIRONMENT ] ; then + DB_ENVIRONMENT="default" +fi + +source env/$DB_ENVIRONMENT.conf function add-version() { psql $PSQL_OPTS -c "update database_versions set is_active = false where is_active = true" $DB_NAME diff --git a/env/default.conf~ b/env/default.conf~ new file mode 100644 index 0000000..1468dba --- /dev/null +++ b/env/default.conf~ @@ -0,0 +1,3 @@ +#!/bin/bash +export PSQL_OPTS="-h localhost -U root" +export DB_NAME=photowall