Reputation: 18810
I am new django south migration. I have my main application and most of additional functions of that application I built as sub applications of the main application. Now what I want to do is reset the tables that are specific to sub application of the main application. I don't want to loose any data from other tables table.
This is how my database look like:
public | tos_agreement | table | g_db_admin
public | tos_agreementversion | table | g_db_admin
public | tos_signature | table | g_db_admin
public | userclickstream_click | table | g_db_admin
public | userclickstream_stream | table | g_db_admin
public | vote | table | g_db_admin
(80 rows)
I only want to re-build (dump all data of)
public | userclickstream_click | table | g_db_admin
public | userclickstream_stream | table | g_db_admin
How can I do this using south migration.
In my south_migrationhistory table I have following:
15 | userclickstream | 0001_initial | 2013-12-10 13:26:15.684678-06
16 | userclickstream | 0002_auto__del_field_stream_auth_user | 2013-12-10 13:26:15.693485-06
17 | userclickstream | 0003_auto__del_field_stream_username__add_field_stream_user | 2013-12-10 13:26:15.721449-06
I assume this record took place when I initially wired up it with south migration.
I was also thinking what if? Delete the above records from south_migrationhistory and re-run the migration for this app which will generate the tables.
./manage.py schemamigration userclickstream --initial
./manage.py migrate userclickstream
Upvotes: 0
Views: 77
Reputation: 18427
Do it this way:
manage.py dumpdata > backup.json
. it will create a json fixture with all data currently in the database. That way, if you screw up anything, you can always re-load the data with manage.py loaddata backup.json
(note that all tables need to be empty for this to work).loaddata
commandThis isn't a coded "here's the solution" answer, but I hope this helps nonetheless
Upvotes: 1