class ModelA:
pass
class ModelB:
model_a = ForeignKey(ModelA)
If I want to rename ModelA
to ModelANew
here is the strategy Django Follows:
- Migration 1: Create
ModelANew
- Migration 2:
- Remove field
model_a
fromModelB
. - Add field
model_a_new
toModelB
- Remove field
- Migration 3: Delete
ModelA
The obvious downside of this is that the information in the table modela
is lost. Can this be done with renaming the model? Django obviously did not ask if this was a rename. Is it possible to inform or make it go that route? If not, what would be a strategy to manually code the migration.