operations = [ migrations.RunSQL( 'CREATE INDEX app_sale_sold_at_b9438ae4 ON app_sale (sold_at);', reverse_sql='DROP INDEX "app_sale_sold_at_b9438ae4";', ), ]
When you run the migration, you will get the following output:
1 2 3 4 5
$ python manage.py migrate Operations to perform: Apply all migrations: app Running migrations: Applying app.0002_add_index_runsql... OK
migrate back to the initial migration:
1 2 3 4 5 6
$ python manage.py migrate 0001 Operations to perform: Target specific migration: 0001_initial, from app Running migrations: Rendering model states... DONE Unapplying app.0002_add_index_fake... OK