Skip to content

Instantly share code, notes, and snippets.

@walterrenner
Created October 14, 2015 12:55
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 walterrenner/d9e0dee53e7c8a4c029f to your computer and use it in GitHub Desktop.
Save walterrenner/d9e0dee53e7c8a4c029f to your computer and use it in GitHub Desktop.
Use project related mirgation modules

Keep your custom Migrations in your project

A proof of concept.

If you cant't/won't use the apps Migration files this workaround can be helpful for you.

We assume you have a clean Database without any Migrations applied and a Project named my_project that you are working on. Add the below snippet in your settings.py right after INSTALLED_APPS.

This tells django to use migration files from the module in my_project.migrations.<appname>.migrations.

If you now run ./manage.py syncdb you custom Migration files will be created in /my_project/migrations//migrations`.

MIGRATION_MODULES = {app: "my_project.migrations.{0}.migrations".format(app) for app in INSTALLED_APPS}
@philippeowagner
Copy link

👍 Cool!

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