1
0
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:
Paveł Tyślacki
2019-02-11 17:24:10 +03:00
committed by Tim Graham
parent 4bb859e246
commit 5c17c273ae
3 changed files with 125 additions and 11 deletions

View File

@@ -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)