Opened 11 years ago
Closed 11 years ago
#23086 closed Uncategorized (duplicate)
Migrations keep altering unique_together
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Migrations | Version: | 1.7-rc-1 |
| 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
Each new migration adds AlterUniqueTogether operation even if that has not changed.
Reproducing:
- Create the following models.py
class A(Model): bar = IntegerField() foo = IntegerField() baz = IntegerField() class Meta: unique_together = (('bar', 'foo'), ) class B(Model): x = IntegerField()
- Create an initial migration. All is good.
- Add a field "y = IntegerField()" to B
- Create a new auto migration.
Expected:
New migration contains only one operation: AddFiled
Actual:
New migration contains the expected AddField operation *and* the following:
migrations.AlterUniqueTogether(
name='a',
unique_together=set([(b'bar', b'foo')]),
Note:
See TracTickets
for help on using tickets.
It's a regression in #23014 which I reopened.