1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Refs #26384 -- Isolated a test model in schema tests.

This commit is contained in:
Simon Charette 2016-12-17 15:02:57 -05:00
parent 8ba01d1e42
commit 96181080ba
2 changed files with 7 additions and 2 deletions

View File

@ -183,3 +183,6 @@ class UniqueTest(models.Model):
class Node(models.Model):
node_id = models.AutoField(primary_key=True)
parent = models.ForeignKey('self', models.CASCADE, null=True, blank=True)
class Meta:
apps = new_apps

View File

@ -48,8 +48,8 @@ class SchemaTests(TransactionTestCase):
models = [
Author, AuthorWithDefaultHeight, AuthorWithEvenLongerName, Book,
BookWeak, BookWithLongName, BookWithO2O, BookWithSlug, IntegerPK, Note,
Tag, TagIndexed, TagM2MTest, TagUniqueRename, Thing, UniqueTest,
BookWeak, BookWithLongName, BookWithO2O, BookWithSlug, IntegerPK, Node,
Note, Tag, TagIndexed, TagM2MTest, TagUniqueRename, Thing, UniqueTest,
]
# Utility functions
@ -2173,6 +2173,8 @@ class SchemaTests(TransactionTestCase):
"""
if connection.vendor == 'mysql' and connection.mysql_version < (5, 6, 6):
self.skipTest('Skip known bug renaming primary keys on older MySQL versions (#24995).')
with connection.schema_editor() as editor:
editor.create_model(Node)
old_field = Node._meta.get_field('node_id')
new_field = AutoField(primary_key=True)
new_field.set_attributes_from_name('id')