Reset South Migrations on a Model

Sometimes when I’m initially developing, I end up with a TON of migrations before I’m ready to push to anything live.  If you’re at a point where you’re willing to dump and recreate, this can come in very handy.


cd $appname

# Remove the old migrations stuff
git rm -r migrations
git commit -m ‘Removed South migrations for the reset’

# Tell South to reset it’s database migrations for that app
./manage.py migrate –delete-ghost-migrations
./manage.py convert_to_south $appname
./manage.py schemamigration $appname –init
./manage.py migrate $appname

Enjoy your shiny new database!

Advertisements

~ by Liz on August 23, 2013.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: