Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

philippeowagner commented Oct 14, 2015

👍 Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.