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:

  1. Create app a, with a model called A. Run makemigrations a
  2. Create app b, with a model called B. Give B a ForeignKey to A. Run makemigrations b
  3. Rename model A to Aa. Run makemigrations a
  4. 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`

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top