South, restore a DB with broken migrations

python manage.py migrate page --list

 page
  (*) 0001_initial
  (*) migrations from 0002 to 0006
  (*) 0007_auto__del_realestatelistcontext__del_homepagecontext__add_listcontext
  (*) 0008_auto__add_field_listcontext_num
  (*) 0009_auto__chg_field_listcontext_content
  (*) 0010_auto__del_field_listcontext_content
  ( ) 0011_auto__add_field_listcontext_content

I messed up things so that both python manage.py migrate page 0009 and python manage.py migrate page 0011 raise DatadaseError.

I'm not interested to fix the broken migrations, but I want to restore the DB back to migration 0008 (I'm able to manually change the Python model as it was in 0008). I'm new to South and seeking suggestions on how to do that.

Answers


If you can manually restore the database state to 0008, you can tell South to treat it as such by "faking" the reverse migration to 0008.

python manage.py migrate page 0008 --fake

This will set the internal state to say the last applied migration is 0008 without trying to actually apply the reverse migrations for 0010 and 0009.


Need Your Help

PHP preg_match expression not matching correct characters

php regex validation preg-match

I'm trying to catch any characters that are not letters, numbers, or .-_ (period, dash, underscore)

Gitolite Error: gitolite-admin not a repo

linux git gitolite

Quick Note: Before anyone points it out, I did originally post this on Server Fault, but after doing so I realized this site may be more appropriate. Sorry for the "double post".

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.