summaryrefslogtreecommitdiff
path: root/tests/schema
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2024-08-30 20:17:17 -0400
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-09-03 08:22:39 +0200
commit6f9c6678bffc4f660382fa6c8836ba2d55dc3c2b (patch)
tree9f153eb8a746f578c2329a9a160558c9d2936c84 /tests/schema
parent4082a8886e8d5f60ab705fcd0aac107778175721 (diff)
Added assertion for the results of migrating an integer pk to SmallAutoField.
Follow up to 7ca42974ee087a82b6f7f6874ca2b25e42a9a584 which did the same for similar tests.
Diffstat (limited to 'tests/schema')
-rw-r--r--tests/schema/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index 3a2947cf43..33a4bc527b 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -2160,6 +2160,19 @@ class SchemaTests(TransactionTestCase):
with connection.schema_editor() as editor:
editor.alter_field(SmallIntegerPK, old_field, new_field, strict=True)
+ # A model representing the updated model.
+ class IntegerPKToSmallAutoField(Model):
+ i = SmallAutoField(primary_key=True)
+
+ class Meta:
+ app_label = "schema"
+ apps = new_apps
+ db_table = SmallIntegerPK._meta.db_table
+
+ # An id (i) is generated by the database.
+ obj = IntegerPKToSmallAutoField.objects.create()
+ self.assertIsNotNone(obj.i)
+
@isolate_apps("schema")
@unittest.skipUnless(connection.vendor == "postgresql", "PostgreSQL specific")
def test_alter_serial_auto_field_to_bigautofield(self):