mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Refs #30172 -- Prevented removing a model Meta's index/unique_together from removing Meta constraints/indexes.
This commit is contained in:
committed by
Tim Graham
parent
4bb859e246
commit
5c17c273ae
@@ -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