mirror of
https://github.com/django/django.git
synced 2024-12-25 18:46:22 +00:00
Merge pull request #2230 from manfre/patch-2
Fix regress added to migrations.test_operations.test_alter_field_pk_fk
This commit is contained in:
commit
788cde326a
@ -349,11 +349,12 @@ class OperationTests(MigrationTestBase):
|
|||||||
self.assertIsInstance(project_state.models["test_alflpkfk", "pony"].get_field_by_name("id"), models.AutoField)
|
self.assertIsInstance(project_state.models["test_alflpkfk", "pony"].get_field_by_name("id"), models.AutoField)
|
||||||
self.assertIsInstance(new_state.models["test_alflpkfk", "pony"].get_field_by_name("id"), models.FloatField)
|
self.assertIsInstance(new_state.models["test_alflpkfk", "pony"].get_field_by_name("id"), models.FloatField)
|
||||||
|
|
||||||
def assertIdTypeEqualsFkType(self):
|
def assertIdTypeEqualsFkType():
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
id_type = [c.type_code for c in connection.introspection.get_table_description(cursor, "test_alflpkfk_pony") if c.name == "id"][0]
|
id_type = [c.type_code for c in connection.introspection.get_table_description(cursor, "test_alflpkfk_pony") if c.name == "id"][0]
|
||||||
fk_type = [c.type_code for c in connection.introspection.get_table_description(cursor, "test_alflpkfk_rider") if c.name == "pony_id"][0]
|
fk_type = [c.type_code for c in connection.introspection.get_table_description(cursor, "test_alflpkfk_rider") if c.name == "pony_id"][0]
|
||||||
self.assertEqual(id_type, fk_type)
|
self.assertEqual(id_type, fk_type)
|
||||||
|
|
||||||
assertIdTypeEqualsFkType()
|
assertIdTypeEqualsFkType()
|
||||||
# Test the database alteration
|
# Test the database alteration
|
||||||
with connection.schema_editor() as editor:
|
with connection.schema_editor() as editor:
|
||||||
|
Loading…
Reference in New Issue
Block a user