Opened 5 years ago

Closed 5 years ago

#23086 closed Uncategorized (duplicate)

Migrations keep altering unique_together

Reported by: aigarius@… 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


Each new migration adds AlterUniqueTogether operation even if that has not changed.


  1. Create the following
    class A(Model):
        bar = IntegerField()
        foo = IntegerField()
        baz = IntegerField()
        class Meta:
            unique_together = (('bar', 'foo'), )
    class B(Model):
        x = IntegerField()
  1. Create an initial migration. All is good.
  2. Add a field "y = IntegerField()" to B
  3. Create a new auto migration.

New migration contains only one operation: AddFiled

New migration contains the expected AddField operation *and* the following:

            unique_together=set([(b'bar', b'foo')]),

Change History (1)

comment:1 Changed 5 years ago by Tim Graham

Resolution: duplicate
Status: newclosed

It's a regression in #23014 which I reopened.

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