summaryrefslogtreecommitdiff
path: root/tests/migrations
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2015-04-11 16:10:31 +0200
committerClaude Paroz <claude@2xlibre.net>2015-04-17 11:01:36 +0200
commitbbfcd9618b06556a0ae2c38456ef38bf3bea9e9d (patch)
treebbfadf2f0cb3fb8ef91830b98fb1a27452d3b9e4 /tests/migrations
parentd0b18542f740b358fb776e2b158ac69ff154896e (diff)
[1.8.x] 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. Backport of 02260ea3f6 from master.
Diffstat (limited to 'tests/migrations')
-rw-r--r--tests/migrations/test_operations.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
index a351154058..7ff798f690 100644
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -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