South schematization / refactoring

I have a Foo model that is inside a bar application. Now I want to move thmodel to app bar2 . I already use db_table when syncdb from bar to

 meta: db_table = 'foo_table' 

Now, when I do the schema with bar , south wants me to delete the table. Are there any ways to avoid this (the table name foo_table still remains unchanged despite changing the application) without manually editing the migration file?

+4
source share
1 answer

If there are no changes to the database, you can create empty migrations for both applications that had this model, and which now have this model:

 ./manage.py schemamigration app1 del_model1 --empty ./manage.py schemamigration app2 add_model1 --empty 

the south analyzes the models described in the last migration, and from these data it creates the following migrations

0
source

Source: https://habr.com/ru/post/1394038/


All Articles