From 7854485534f7feaee7843684fb40fee8323faa19 Mon Sep 17 00:00:00 2001 From: Jesus Federico Date: Tue, 15 Oct 2019 12:15:45 -0400 Subject: [PATCH] Updated script for start (#838) --- .gitignore | 2 ++ bin/start | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a9ff8afb..20667ff4 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,5 @@ env config/terms.md coverage* + +/atom-sftp-sync.json diff --git a/bin/start b/bin/start index 2bcb8ca1..d4d775c0 100755 --- a/bin/start +++ b/bin/start @@ -8,10 +8,15 @@ if [ "$RAILS_ENV" = "production" ] && [ "$DB_ADAPTER" = "postgresql" ]; then done fi -bundle exec rake db:create +db_create=$(RAILS_ENV=$RAILS_ENV bundle exec rake db:create) +echo $db_create -if ! bundle exec rake db:migrate ; then - export DB_MIGRATE_FAILED=1 +if [[ $db_create == *"ERROR"* ]]; then + echo ">>> Database migration" + bundle exec rake db:migrate +else + echo ">>> Database initialization" + bundle exec rake db:setup fi bundle exec rake assets:precompile