Friday, October 21, 2016

Re: Django 1.8: Existing Migrations Files Erroring After FK Model Removed

It might be that you've made a mistake such as importing a model for RunPython rather than using apps.get_model(). Could you share the traceback?

On Friday, October 21, 2016 at 7:18:05 AM UTC-4, dy...@dylan-jenkinson.nz wrote:
Hi there,

In one of our projects we have removed an old model that was no longer used. It was used as a FK on a couple of other models, so there are old migrations that have the model in them. I am trying to migrate into a fresh new DB to do some new work on the app. The migrations proceed happily until they hit this FK, where they then blow up with a ValueError: Related model 'x' cannot be resolved. I thought to try squishing the migrations to remove the need for that FK migration, but that does not seem to have helped. I suspect that this is related to the fact that the model is in a different application, and maybe that means that the squishing cannot figure out that it is no longer there?

What I would like to know is how other people approach this problem? How would you remove an existing but no longer used model from your system? Is there a recommended way of doing this?

Thanks for any help or advice.

Dylan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4cd65e81-f112-4819-b162-904e2b855224%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment