[Answered ]-Recreate the tables for a single Django 1.7 app

2👍

If your Django migration subsystem is not broken in itself, the normal way to reset an app is to run manage.py migrate <app> zero.

This will run all of the app’s migrations backwards, so a few things are noteworthy:

  • if some of the app’s migrations are not reversible, the process will fail. Should not happen normally as Django only creates reversible migrations. You can build irreversible ones yourself, though – usually when you create data migrations.

  • if some other app has a dependency on this app, it will also be migrated backwards up to the last migration that did not depend on it.

You can then run migrate again, so it is run forwards.

In any case, remember migrations introduce a risk for your data, so backup your database before touching anything.

Leave a comment