Skip to content

Instantly share code, notes, and snippets.

@pricco
Last active August 29, 2015 14:08
Show Gist options
  • Save pricco/48e20e9a5b65bed3e65d to your computer and use it in GitHub Desktop.
Save pricco/48e20e9a5b65bed3e65d to your computer and use it in GitHub Desktop.
Merge Django 1.7 Migrations

Merge Django 1.7 Migrations

  • Remove migrations for each app
  • Run makemigrations for each app
  • Remove each migration > 0001
  • Edit each 0001_initial migration
  • Remove operations distinct of migrations.CreateModel
  • Remove fields of type ForeignKeyField or ManyToManyField
  • Clear dependencies = []
  • Run makemigrations again for each app
  • Edit each 0002 migration and change each dependency for 0001_initial
  • Change the name of each 0002 migration for the last know migration of each app
  • If you only have one 0001 migration rename this
  • Done!
@RodrigoEspinosa
Copy link

🏃

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