Opened 6 years ago
Last modified 6 years ago
#29588 closed Bug
Unique_together constraint not inherited from abstract model in migration file — at Version 2
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 (last modified by )
I added a unique_together
constraint on my abstract model like this:
class InvoicingDocument(models.Model): field1 = models.IntegerField() field2 = models.IntegerField() 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 (2)
comment:1 by , 6 years ago
comment:2 by , 6 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.
Hello Ron,
Could you provide an exact reproduction case for your issue. From a quick look your models are not valid because
field1
andfield2
are not defined on your abstract model.