From 1a0cef9883765ab20112188811ce274da40c3372 Mon Sep 17 00:00:00 2001 From: James Athey Date: Fri, 30 Mar 2018 10:08:02 -0400 Subject: [PATCH] in production, run db:migrate, in all other environments, run db:setup --- .ebextensions/rails.config | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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