diff options
| author | Baptiste Mispelon <bmispelon@gmail.com> | 2014-02-28 13:14:09 +0100 |
|---|---|---|
| committer | Baptiste Mispelon <bmispelon@gmail.com> | 2014-03-01 13:45:45 +0100 |
| commit | c679cb7f600b13646a1a2b5fc8a03dfcc2e413f2 (patch) | |
| tree | 976f24bdfbca904fdaafcf0fdbec609e19dc76e5 /tests | |
| parent | a19f0d0c1e128634b9e393c52148167bf8718b4c (diff) | |
Fixed #22168 -- Fixed migrations failing on sqlite when column names are SQL keywords
Thanks to trac user fallen_flint for the report and initial patch.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/migrations/test_operations.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py index 1390638270..51c95afd96 100644 --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -195,6 +195,23 @@ class OperationTests(MigrationTestBase): operation.database_backwards("test_adfl", editor, new_state, project_state) self.assertColumnNotExists("test_adfl_pony", "height") + def test_column_name_quoting(self): + """ + Column names that are SQL keywords shouldn't cause problems when used + in migrations (#22168). + """ + project_state = self.set_up_test_model("test_regr22168") + operation = migrations.AddField( + "Pony", + "order", + models.IntegerField(default=0), + ) + new_state = project_state.clone() + operation.state_forwards("test_regr22168", new_state) + with connection.schema_editor() as editor: + operation.database_forwards("test_regr22168", editor, project_state, new_state) + self.assertColumnExists("test_regr22168_pony", "order") + def test_add_field_preserve_default(self): """ Tests the AddField operation's state alteration |
