'Django migrations circular dependency what is the best practice?
I would like to know the best practice to handle circular dependency when migrating apps.
Our CRM has two Apps with several model fields depending on each other.
We need to reconstruct the database everyday and this lead us to delete all our existing migration files and create new ones everyday.
In our code the foreign keys are referenced with :
model_name = models.ForeignKey('app.model', ...)
So no issues at runtime.
But at night, when we recreate and apply the migrations, we made a migrate script that basically swaps the foreign keys as IntegerField to prevent CircularDependencyError and reswaps them after the depencies are solved.
Is there a better way to do this ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
