I have a Django app named app1
with models and migrations files.
I renamed this app to app2
and I fixed all imports, urls etc...
I now have a problem with migrations files and data in tables.
How can I write migrations with the correct way to ensure:
Note 1: there is several tables with many Foreign Keys.
Here is my progress so far and I am not sure if I am on the good way:
python manage.py makemigrations
to generate new migrations filesAfter these 2 steps, I can install my application but I still have problems with old version.
Question: What is the best way to migrate data?
Note 2: I don't use South
.
I found a solution that's works
migrations.CreateModel.options
, add db_table: 'app1_table_name'
replaces = [('app1', 'migration_file_name')]
. This will tell to Django that current migration (app2.migration_file_name
) will replace the old file, this will prevenent django to execute migrations twice.migrations.AlterModelTable
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With