diff options
| author | Motiejus Jakštys <motiejus.jakstys@spilgames.com> | 2014-04-16 16:55:34 +0200 |
|---|---|---|
| committer | Simon Charette <charette.s@gmail.com> | 2014-04-16 15:38:31 -0400 |
| commit | 0e45669fa9eb82c6de8e226c6da53ab5e88575f5 (patch) | |
| tree | 31985645c7cf3117c73bbb5f55725a246e18c9dc /tests | |
| parent | b5ce21accb57a5b70420574647d56eb837eb7722 (diff) | |
Fixed #22460 -- Explicity remove constraints when dropping a related field.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/migrations/test_operations.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py index efa16ee7a0..6472fea42c 100644 --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -416,6 +416,22 @@ class OperationTests(MigrationTestBase): operation.database_backwards("test_rmfl", editor, new_state, project_state) self.assertColumnExists("test_rmfl_pony", "pink") + def test_remove_fk(self): + """ + Tests the RemoveField operation on a foreign key. + """ + project_state = self.set_up_test_model("test_rfk", related_model=True) + self.assertColumnExists("test_rfk_rider", "pony_id") + operation = migrations.RemoveField("Rider", "pony") + new_state = project_state.clone() + operation.state_forwards("test_rfk", new_state) + with connection.schema_editor() as editor: + operation.database_forwards("test_rfk", editor, project_state, new_state) + self.assertColumnNotExists("test_rfk_rider", "pony_id") + with connection.schema_editor() as editor: + operation.database_backwards("test_rfk", editor, new_state, project_state) + self.assertColumnExists("test_rfk_rider", "pony_id") + def test_alter_model_table(self): """ Tests the AlterModelTable operation. |
