Skip to content

Commit

Permalink
Disable troublesome migration
Browse files Browse the repository at this point in the history
Run rails db:seed in review environment when app starts

Updated Dockerfile to use a app startup shell script for that effect
  • Loading branch information
fumimowdan committed Sep 14, 2023
1 parent 723149f commit 0a38c1f
Showing 3 changed files with 18 additions and 6 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -44,5 +44,4 @@ ENV GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_ID=$GOVUK_NOTIFY_GENERIC_EMAIL_TEMPLATE_
RUN bundle exec rake assets:precompile && \
rm -rf node_modules tmp

CMD bundle exec rails db:migrate && \
bundle exec rails server -b 0.0.0.0
CMD ./bin/app-startup.sh
16 changes: 16 additions & 0 deletions bin/app-startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env sh
#
# Dockerfile application startup script
#

# run migrations
bundle exec rails db:migrate

# add seed data in review environment
if [ "$RAILS_ENV" = "review" ]; then
echo "Running rails db:seed"
bundle exec rails db:seed
fi

# start server
bundle exec rails server -b 0.0.0.0
5 changes: 1 addition & 4 deletions db/migrate/20230721082851_enable_opening_times.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
class EnableOpeningTimes < ActiveRecord::Migration[7.0]
def change
AppSettings.current.update!(
service_start_date: Time.zone.yesterday,
service_end_date: Time.zone.today + 1.year,
)
# Disable this migration and move code into task `rake set_app_settings`
end
end

0 comments on commit 0a38c1f

Please sign in to comment.