How to transfer back from initial migration to Django 1.7?

I created a new application with some models, and now I noticed that some of the models are poorly thought out. Since I did not pass the code, it would be wise to switch the database to the last good condition and redo the migration using the best models. In this case, the last good condition is the database in which the new application does not exist.

How can I transfer back from initial migration to Django 1.7?

In South you can do:

 python manage.py migrate <app> zero 

To clear the <app> from the migration history and discard all <app> tables.

How to do this with migrations of Django 1.7?

+71
python django django-migrations
Sep 01 '14 at 13:24
source share
2 answers

You can do the same with Django 1.7+ also:

 python manage.py migrate <app> zero 

This clears the <app> from the migration history and deletes all <app> tables

For more information see Django docs .

+129
Sep 01 '14 at 14:25
source share

you can also use version number:

 python manage.py migrate <app> 0002 

Source: https://docs.djangoproject.com/en/1.7/ref/django-admin/#django-admin-migrate

+11
Jul 28 '15 at 16:42
source share



All Articles