mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
[2.2.x] Refs #30172 -- Prevented removing a model Meta's index/unique_together from removing Meta constraints/indexes.
Backport of 5c17c273ae from master.
This commit is contained in:
committed by
Tim Graham
parent
3dd5e71752
commit
2a92e2e3c1
@@ -62,6 +62,24 @@ class AuthorWithUniqueName(models.Model):
|
||||
apps = new_apps
|
||||
|
||||
|
||||
class AuthorWithIndexedNameAndBirthday(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
birthday = models.DateField()
|
||||
|
||||
class Meta:
|
||||
apps = new_apps
|
||||
index_together = [['name', 'birthday']]
|
||||
|
||||
|
||||
class AuthorWithUniqueNameAndBirthday(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
birthday = models.DateField()
|
||||
|
||||
class Meta:
|
||||
apps = new_apps
|
||||
unique_together = [['name', 'birthday']]
|
||||
|
||||
|
||||
class Book(models.Model):
|
||||
author = models.ForeignKey(Author, models.CASCADE)
|
||||
title = models.CharField(max_length=100, db_index=True)
|
||||
|
||||
Reference in New Issue
Block a user