We're trying to remove a model completely from one of our apps - an 
operation I think we've done many times without issues, but this time it's 
causing us some headache. Consider we have two apps:

An app called a with a model A
An app called b with a model B, and this model B has a foreign key to A.

This means the initial Django migration file for app b contains an entry 
for a foreign key to the string 'a.A'. Let's call this step 1.

Now later, we remove the foreign key on model B. This of course creates a 
new migration, but the initial migration still has the 'a.A' foreign key 
definition in it (obviously). Let's call this step 2.

Now the tricky part: we want to remove the whole model A. This in itself 
creates a migration for app a to that deletes the model, but poses a new 
problem; when running the full migration history (for example during 
tests), the initial migration of app b will fail, because it can no longer 
resolve 'a.A'. Let's call this step 3.

How are people coping with the issue the best? One solution I can think of 
involves doing a migration squash (and would be sort of easy in our case, 
since we're actually going to remove the whole app a as well), but it seems 
a bit extreme. Is there anyone out there with a better and less intrusive 
solution?

Regards,
Henrik Ossipoff Hansen

-- 
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+unsubscr...@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/162da80d-ca64-48d1-b555-4ce44d6040aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to