Opened 6 years ago

Last modified 6 years ago

#29588 closed Bug

Unique_together constraint not inherited from abstract model in migration file — at Initial Version

Reported by: Ronny Vedrilla Owned by: nobody
Component: Migrations Version: 2.0
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 added a unique_together constraint on my abstract model like this:

class InvoicingDocument(models.Model):
       class Meta:
       abstract = True
       unique_together = (('field1', 'field2'),)

class Invoice(InvoicingDocument):
       pass

When I run manage.py makemigrations the migration file does not contain any information about adding the index to the model Invoice.

When I add it to the child-class, it works.

I guess this is an issue with django-migrations?

Best regards
Ronny

Change History (0)

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