Skip to main content

How to start over with your local database

Delete fucked up db: bundle exec rake db:drop

Make empty db: bundle exec rake db:create

Go into gem file and comment out 'zero_downtime_migrations'

bundle install

bundle exec rake db:migrate (until it crashes)

You may have to comment out some migrations... and in the middle at some point you'll need data from the seed file and app table (https://powr.gitlab.io/docs/engineering/102)...

bundle exec rake db:seed rake utility:json_to_app_copy. (adds app details stuff) AppDetail.update_all(active: true) in rails console

and then continue bundle exec rake db:migrate (until it yells at you about safety_assured)

Now go back to gem file and uncomment 'zero_downtime_migrations'

bundle install

and yet again bundle exec rake db:migrate

Your server SHOULD now run...​

Additional helpful things to do right away:

Make an admin user:

admin = Role.find_or_create_by(name: "admin") u = User.find_by_email(<email>) u.roles << admin u.save

Fix Blacklist error:

Run in rails C: PhishingBlacklist.create(blacklisted_words: ['password'])