[Fixed]-Remove app with Django 1.7 migrations


you’d have to be careful with this one, make sure you understand the operations being reversed when you do it, but something like this should work:

manage.py migrate <app_name> zero

obviously you have to do this before removing it from your settings and such so migrations are discoverable.

edit: this has slowly been receiving a few upvotes – I figured I’d direct everybody towards the appropriate documentation, in particular:

Use the name zero to unapply all migrations for an app.


First, comment out all the classes in your app’s models.py. Then, create a new migration as you normally would, which will delete all the app’s tables, and run it. Finally, remove the entire app and all references to it from your code base.


extending nachouve’s answer to a proper django migration, you can use a RunSQL migration with all the DROP statements, see the django migration docs.

You can either put this in the app your about to delete or (if you’ve already deleted the app or it’s installed so you can’t edit it) in a different app.

For example to clean up after deleting django-user-accounts (which has poor coverage and is a liability):

from django.db import migrations

    DROP TABLE IF EXISTS account_account CASCADE;
    DROP TABLE IF EXISTS account_accountdeletion CASCADE;
    DROP TABLE IF EXISTS account_emailaddress CASCADE;
    DROP TABLE IF EXISTS account_emailconfirmation CASCADE;
    DROP TABLE IF EXISTS account_signupcode CASCADE;
    DROP TABLE IF EXISTS account_signupcoderesult CASCADE;

class Migration(migrations.Migration):

    dependencies = [
        ('auth', '<< previous migations >>'),

    operations = [

Leave a comment