Opened 9 years ago
Closed 9 years ago
#25521 closed Cleanup/optimization (needsinfo)
squashmigrations tries to add foreign keys to removed models
Reported by: | Kevin Turner | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I squashed a bunch of migrations in an app we'll call "foo". There was something like this going on:
- on foo.Foo add ForeignKey to bar.Bar
- on foo.Foo remove ForeignKey to bar.Bar
- remove model bar.Bar
this ended up with a squashed migration with both AddField and RemoveField in it, which seems inefficient but might have worked. The problem was that, since the target model had been entirely removed in the depended-upon state, the AddField to it didn't work at all. (and failed with some misleading message in BaseDatabaseSchemaEditor.add_field
about unicode has no attribute _meta
.)
This was in Django 1.8.5. Haven't tried other versions.
Change History (1)
comment:1 by , 9 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Type: | Uncategorized → Cleanup/optimization |
I think we'll need more specific steps to reproduce the issue. Here's what I tried:
Tested at a76309f007fff6957f39190b06f8a9055f73130f (Django 1.10.dev).