For marketers
who love technology
Home » » How to migrate Django from Mysql to south (the radical way)?

How to migrate Django from Mysql to south (the radical way)?

database
database (Photo credit: Sean MacEntee)
I am new to south, and I made some mistakes with it. Fortunately, my database does not contain important data and I can recreate it from scratch. So let's do it.

mysql -u root -p
> show databases;
> use my_db
> show tables;

Then i drop my web app's tables (and not the ones related to django..)
> drop table myapp_table;

I also drop the table with south's migration history and delete the migration folder, to start from a clean state

> drop table south_migrationhistory;

rm -Rf myApp/migrations/

Now everything should be ok. I remove south from installed apps in settings.py, and I recreate the databases

./manage.py syncdb

Now, if we want to add back south (I'm not a quitter ;) ). First we put it back in the list of installed apps in settings.py. Then we resynchronize our databases, convert our project to use south


python manage.py syncdb
python manage.py convert_to_south myApp

That's it! Now you can use south carefully (see the tutorial). 

SHARE

About Gilles

0 comments :

Post a Comment