Skip to content

Instantly share code, notes, and snippets.

@chrisarevir
Last active December 20, 2018 23:08
Show Gist options
  • Save chrisarevir/6e794e24f298ad92e214446988b1f771 to your computer and use it in GitHub Desktop.
Save chrisarevir/6e794e24f298ad92e214446988b1f771 to your computer and use it in GitHub Desktop.
Reset for Rails DB
Dealing with conflicts to db/structure.sql (when merging master)
$ git checkout master
# Change database.yml to point to database: clean (on localhost) in development env
# In one command:
# 1) drops the database specified in database.yml for current env ('clean' database)
# 2) creates a db with name specified in database.yml
# 3) loads master's structure into the database specified in database.yml
$ bin/rake db:drop db:create db:structure:load
# Checkout your branch
$ git pull origin master
$ bin/rake db:migrate -- may need to comment out migration code that relies on data but does not change the schema
# commit and push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment