Skip to content

Instantly share code, notes, and snippets.

@thephw
Forked from hwhelchel/schema_change.sh
Last active November 9, 2015 18:04
Show Gist options
  • Save thephw/10843b5ec89c7746fe8d to your computer and use it in GitHub Desktop.
Save thephw/10843b5ec89c7746fe8d to your computer and use it in GitHub Desktop.
Undesired Rails Schema Changed (Column moved etc.)
pg_dump --create --column-inserts melody_development > melody_development_dump.sql # or whatever your database is called
# edit dump.sql and change the column order
# stop webserver
be rake db:drop
be rake db:create
psql -f melody_development_dump.sql melody_development
be rake db:migrate
be rake db:test:prepare
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment