sutty/bin/migrate_database
2019-09-24 16:34:34 -03:00

18 lines
450 B
Bash
Executable file

#!/bin/sh
set -e
cd /srv/http
test -f data/production.sqlite3.migrated && exit 0
bundle exec rake db:data:dump_dir dir=data
cat config/database.yml.pg > config/database.yml
bundle exec rake db:schema:load
rm db/data/ar_internal_metadata.yml
mv db/data/active_storage_attachments.yml db/data/zz_active_storage_attachments.yml
bundle exec rake db:data:load_dir dir=data truncate=false
mv data/production.sqlite3 data/production.sqlite3.migrated