Hi
Suppose I have two apps named “core” and “accounting”. And back then, I had a model in the core app named cluster. In the accounting app, I had multiple models that related to this cluster model as a foreign key.
After a while, I deleted the cluster model and everything related to it. I migrated and didn’t have any problems.
But for a new database that I ran migrate, It started migrating from the first migration files and caused this error in those models in app b which had been related to cluster:
“ValueError: Related model ‘core.cluster’ cannot be resolved”
It happens because it runs all migrations in the core app, including the migration that deletes the cluster model. And after that, It runs migrations in the accounting app. In the third migration, which models reference to core.cluster, this error happens.
Could you help me? What did I do wrong?
And I have two general questions:
- Is it good to change old migrations manually? Like deleting these fk relations to cluster in accounting models in the old migrations.
- What is the best way to delete a model in a way that doesn’t lead to problems in other models and their old and new migration files?
Thank you.