diff options
| author | Simon Charette <charette.s@gmail.com> | 2016-12-17 15:02:57 -0500 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2016-12-23 21:43:49 -0500 |
| commit | 96181080bae66ee4f4e6d52bddcd57fa420a929b (patch) | |
| tree | f7f3a94efee425998a9bcdff8e0865c87c0c777d | |
| parent | 8ba01d1e42bfb49cfea323a7f23365a819b16214 (diff) | |
Refs #26384 -- Isolated a test model in schema tests.
| -rw-r--r-- | tests/schema/models.py | 3 | ||||
| -rw-r--r-- | tests/schema/tests.py | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/tests/schema/models.py b/tests/schema/models.py index af6469f64b..7d13c775a3 100644 --- a/tests/schema/models.py +++ b/tests/schema/models.py @@ -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 diff --git a/tests/schema/tests.py b/tests/schema/tests.py index 8f5cab808b..e8cb1996cb 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -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') |
