Added assertion for the results of migrating an integer pk to SmallAutoField.

Follow up to 7ca42974ee which did the same for
similar tests.
This commit is contained in:
Tim Graham 2024-08-30 20:17:17 -04:00 committed by Sarah Boyce
parent 4082a8886e
commit 6f9c6678bf
1 changed files with 13 additions and 0 deletions

View File

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