Skip to content

Instantly share code, notes, and snippets.

@marcusshepp
Created October 25, 2016 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusshepp/77205c2664b3fe0aa9db9e0c37ffa3ed to your computer and use it in GitHub Desktop.
Save marcusshepp/77205c2664b3fe0aa9db9e0c37ffa3ed to your computer and use it in GitHub Desktop.
How to reset an app with an existing migration in production on postgres. Had a problem where I deployed a project with a new app with an initial migration. Then changed the migration in dev. Then redeployed with a different initial migration.
psql -h 999.999.99.99 -U web_forms web_forms
web_forms=> SELECT * from django_migrations;
web_forms=> DELETE FROM django_migrations WHERE id=28;
web_forms=> DROP TABLE room_change_request_type;
# drop all tables from that app
web_forms=> \q
./manage.py migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment