diff options
| author | Tim Graham <timograham@gmail.com> | 2014-12-04 09:11:30 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-12-04 10:57:10 -0500 |
| commit | 765fa36d57d08d0568438f6fd74521e7a56abb61 (patch) | |
| tree | 704c6b07f0b74dc50d535b80bfbec5fea9e14bff /tests | |
| parent | 018d110ef547acb71b0526d0ff934e1e476244e4 (diff) | |
Fixed #23920 -- Fixed MySQL crash when adding blank=True to TextField.
Thanks wkornewald for the report and Markus Holtermann for review.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/schema/models.py | 4 | ||||
| -rw-r--r-- | tests/schema/tests.py | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/schema/models.py b/tests/schema/models.py index 3139838b97..df8a1c5ce4 100644 --- a/tests/schema/models.py +++ b/tests/schema/models.py @@ -171,3 +171,7 @@ class Thing(models.Model): def __str__(self): return self.when + + +class Note(models.Model): + info = models.TextField() diff --git a/tests/schema/tests.py b/tests/schema/tests.py index 42a748454a..730af87abf 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -10,7 +10,7 @@ from django.db.transaction import atomic from .models import (Author, AuthorWithDefaultHeight, AuthorWithM2M, Book, BookWithLongName, BookWithSlug, BookWithM2M, Tag, TagIndexed, TagM2MTest, TagUniqueRename, UniqueTest, Thing, TagThrough, BookWithM2MThrough, AuthorTag, AuthorWithM2MThrough, - AuthorWithEvenLongerName, BookWeak) + AuthorWithEvenLongerName, BookWeak, Note) class SchemaTests(TransactionTestCase): @@ -416,6 +416,19 @@ class SchemaTests(TransactionTestCase): self.assertEqual(columns['name'][0], "TextField") self.assertEqual(bool(columns['name'][1][6]), False) + def test_alter_text_field(self): + # Regression for "BLOB/TEXT column 'info' can't have a default value") + # on MySQL. + new_field = TextField(blank=True) + new_field.set_attributes_from_name("info") + with connection.schema_editor() as editor: + editor.alter_field( + Note, + Note._meta.get_field_by_name("info")[0], + new_field, + strict=True, + ) + def test_alter_null_to_not_null(self): """ #23609 - Tests handling of default values when altering from NULL to NOT NULL. |
