Skip to content

Instantly share code, notes, and snippets.

@messanjah
Last active January 21, 2019 14:16
Show Gist options
  • Save messanjah/e7580365f219e870df67 to your computer and use it in GitHub Desktop.
Save messanjah/e7580365f219e870df67 to your computer and use it in GitHub Desktop.
Steps to commit a cleanly merged db/structure.sql file
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
@spencerneste
Copy link

Works great. I also ran line 11 with a particular seed and there were no issues.

@aks
Copy link

aks commented Dec 14, 2016

If tests are about to be run, rake test:prepare might be needed too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment