mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
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:
parent
4082a8886e
commit
6f9c6678bf
@ -2160,6 +2160,19 @@ class SchemaTests(TransactionTestCase):
|
|||||||
with connection.schema_editor() as editor:
|
with connection.schema_editor() as editor:
|
||||||
editor.alter_field(SmallIntegerPK, old_field, new_field, strict=True)
|
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")
|
@isolate_apps("schema")
|
||||||
@unittest.skipUnless(connection.vendor == "postgresql", "PostgreSQL specific")
|
@unittest.skipUnless(connection.vendor == "postgresql", "PostgreSQL specific")
|
||||||
def test_alter_serial_auto_field_to_bigautofield(self):
|
def test_alter_serial_auto_field_to_bigautofield(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user