Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django south - how to abandon a mistaken (and broken) migration

"South" is the tool that automates database migrations for Django.

How can I "abandon" or "delete" a pending django south migration? I made a mistake and briefly asked django to make an impossible constraint. I thus can't get past step 09 to get to step 10:

 # python2.7 manage.py migrate --list

 django_authopenid
  (*) 0001_initial
 ...

 mymodule
  (*) 0001_initial
  (*) 0008_auto__add_mystuff__chg_field_facetanswer_answer_note__del_field_facetq
  ...
  ( ) 0009_auto__add_module_redit__add_unique_mystuff_who__chg_field_product_desc
  ( ) 0010_auto__del_unique_mystuff_who

If i could simply abandon step 09 and 10, I could run 'python2.7 manage.py schemamigration --auto' again and be up and running. How can I get past the mistake? I could comment out the 'impossible' lines in migration 08's python file, but I could see that causing problems.

Related but not quite on point is What's the recommended approach to resetting migration history using Django South?

like image 728
Bryce Avatar asked Mar 08 '12 02:03

Bryce


People also ask

Can I delete all migrations Django?

Yes you can delete the migrations in django but it can create following errors. If you change the model again and create migration, it will have all the information from the beginning of model creation so when you migrate the migration in db you will get the error that “this table or column already present in table”.


1 Answers

There is no * around 0009 and 0010 schemamigration, meaning they haven't been applied. You can simply delete them as they mean nothing to the DB right now.

p.s. To make sure open your DB and see if there are any new changes

like image 118
Zain Khan Avatar answered Sep 28 '22 08:09

Zain Khan