diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-01-04 05:50:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-04 05:50:00 +0100 |
| commit | 30613d6a748fce18919ff8b0da166d9fda2ed9bc (patch) | |
| tree | a3ddfcff5c655e490e6c9d87cf53fa8e15b899a2 /tests | |
| parent | 0ab58c120939093fea90822f376e1866fc714d1f (diff) | |
Fixed #33408 -- Fixed adding nullable unique fields on SQLite.
Regression in 2f73e5406d54cb8945e187eff302a3a3373350be.
Thanks Alan Crosswell for the report.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/schema/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py index cd6a52f6af..60e69503cc 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -624,6 +624,18 @@ class SchemaTests(TransactionTestCase): # Make sure the values were transformed correctly self.assertEqual(Author.objects.extra(where=["thing = 1"]).count(), 2) + def test_add_field_o2o_nullable(self): + with connection.schema_editor() as editor: + editor.create_model(Author) + editor.create_model(Note) + new_field = OneToOneField(Note, CASCADE, null=True) + new_field.set_attributes_from_name('note') + with connection.schema_editor() as editor: + editor.add_field(Author, new_field) + columns = self.column_classes(Author) + self.assertIn('note_id', columns) + self.assertTrue(columns['note_id'][1][6]) + def test_add_field_binary(self): """ Tests binary fields get a sane default (#22851) |
