summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2015-09-12 22:06:35 +0300
committerTim Graham <timograham@gmail.com>2015-09-14 12:28:04 -0400
commit69017bade0bcce0671e7d64c5a78626efa82a4ff (patch)
tree94c520c5f1519e28bce7bc804fc21661a39cc9f5 /tests
parent07e01dce4091a6bb5bba1f8ae6490ff32c40e3bf (diff)
[1.8.x] Fixed #25393 -- Fixed MySQL crash when adding text/blob field with unhashable default.
Backport of 4d933ad4181a511f3ced98edba4e17aff054e0e2 from master
Diffstat (limited to 'tests')
-rw-r--r--tests/schema/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index aa35bfddc9..d4a411ecfe 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -1535,3 +1535,15 @@ class SchemaTests(TransactionTestCase):
cursor.execute("SELECT surname FROM schema_author;")
item = cursor.fetchall()[0]
self.assertEqual(item[0], None if connection.features.interprets_empty_strings_as_nulls else '')
+
+ def test_add_textfield_unhashable_default(self):
+ # Create the table
+ with connection.schema_editor() as editor:
+ editor.create_model(Author)
+ # Create a row
+ Author.objects.create(name='Anonymous1')
+ # Create a field that has an unhashable default
+ new_field = TextField(default={})
+ new_field.set_attributes_from_name("info")
+ with connection.schema_editor() as editor:
+ editor.add_field(Author, new_field)