Opened 7 years ago
Last modified 7 years ago
#28493 closed Bug
Foreign keys break on migration if models are renamed in a different app — at Initial Version
Reported by: | Christopher Neugebauer | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.11 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Steps to reproduce:
- Create app
a
, with a model calledA
. Runmakemigrations a
- Create app
b
, with a model calledB
. GiveB
aForeignKey
toA
. Runmakemigrations b
- Rename model
A
toAa
. Runmakemigrations a
- Run
migrate
Expected behaviour:
The migration completes successfully
Actual behaviour:
Migration 0001
on b
is run after migration 0002
on a
, and the migration fails with the following error:
` raise ValueError('Related model %r cannot be resolved' % self.remote_field.model)
ValueError: Related model u'a.A' cannot be resolved`
Note:
See TracTickets
for help on using tickets.