diff --git a/.ebextensions/rails.config b/.ebextensions/rails.config index beb1fa1c..69b9db18 100644 --- a/.ebextensions/rails.config +++ b/.ebextensions/rails.config @@ -11,8 +11,12 @@ files: cd $(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir) - if [ "$EB_ENVIRONMENT" != "move-mil-prod" ] + if [ "$EB_ENVIRONMENT" == "move-mil-prod" ] then + # In production, ensure that DB migrations run because this might be a new version of the app that requires it, but do not blow the DB away and re-seed + su -s /bin/bash -c 'DISABLE_DATABASE_ENVIRONMENT_CHECK=1 bin/rails db:migrate' $(/opt/elasticbeanstalk/bin/get-config container -k app_user) + else + # In all other environments, for simplicity and ease of development, just blow the DB away and re-seed su -s /bin/bash -c 'DISABLE_DATABASE_ENVIRONMENT_CHECK=1 bin/rails db:setup' $(/opt/elasticbeanstalk/bin/get-config container -k app_user) fi