Refs #26384 -- Isolated a test model in schema tests.
This commit is contained in:
parent
8ba01d1e42
commit
96181080ba
|
@ -183,3 +183,6 @@ class UniqueTest(models.Model):
|
||||||
class Node(models.Model):
|
class Node(models.Model):
|
||||||
node_id = models.AutoField(primary_key=True)
|
node_id = models.AutoField(primary_key=True)
|
||||||
parent = models.ForeignKey('self', models.CASCADE, null=True, blank=True)
|
parent = models.ForeignKey('self', models.CASCADE, null=True, blank=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
apps = new_apps
|
||||||
|
|
|
@ -48,8 +48,8 @@ class SchemaTests(TransactionTestCase):
|
||||||
|
|
||||||
models = [
|
models = [
|
||||||
Author, AuthorWithDefaultHeight, AuthorWithEvenLongerName, Book,
|
Author, AuthorWithDefaultHeight, AuthorWithEvenLongerName, Book,
|
||||||
BookWeak, BookWithLongName, BookWithO2O, BookWithSlug, IntegerPK, Note,
|
BookWeak, BookWithLongName, BookWithO2O, BookWithSlug, IntegerPK, Node,
|
||||||
Tag, TagIndexed, TagM2MTest, TagUniqueRename, Thing, UniqueTest,
|
Note, Tag, TagIndexed, TagM2MTest, TagUniqueRename, Thing, UniqueTest,
|
||||||
]
|
]
|
||||||
|
|
||||||
# Utility functions
|
# Utility functions
|
||||||
|
@ -2173,6 +2173,8 @@ class SchemaTests(TransactionTestCase):
|
||||||
"""
|
"""
|
||||||
if connection.vendor == 'mysql' and connection.mysql_version < (5, 6, 6):
|
if connection.vendor == 'mysql' and connection.mysql_version < (5, 6, 6):
|
||||||
self.skipTest('Skip known bug renaming primary keys on older MySQL versions (#24995).')
|
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')
|
old_field = Node._meta.get_field('node_id')
|
||||||
new_field = AutoField(primary_key=True)
|
new_field = AutoField(primary_key=True)
|
||||||
new_field.set_attributes_from_name('id')
|
new_field.set_attributes_from_name('id')
|
||||||
|
|
Loading…
Reference in New Issue