mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #24595 -- Prevented loss of null info in MySQL field alteration
Thanks Simon Percivall for the report, and Simon Charette and Tim Graham for the reviews.
This commit is contained in:
@@ -1101,9 +1101,18 @@ class OperationTests(OperationTestBase):
|
||||
|
||||
def assertIdTypeEqualsFkType():
|
||||
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]
|
||||
fk_type = [c.type_code for c in connection.introspection.get_table_description(cursor, "test_alflpkfk_rider") if c.name == "pony_id"][0]
|
||||
id_type, id_null = [
|
||||
(c.type_code, c.null_ok)
|
||||
for c in connection.introspection.get_table_description(cursor, "test_alflpkfk_pony")
|
||||
if c.name == "id"
|
||||
][0]
|
||||
fk_type, fk_null = [
|
||||
(c.type_code, c.null_ok)
|
||||
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_null, fk_null)
|
||||
|
||||
assertIdTypeEqualsFkType()
|
||||
# Test the database alteration
|
||||
|
||||
Reference in New Issue
Block a user