summaryrefslogtreecommitdiff
path: root/tests/custom_migration_operations/operations.py
diff options
context:
space:
mode:
authorMatthew Schinckel <matt@schinckel.net>2014-06-11 22:30:52 +0930
committerTim Graham <timograham@gmail.com>2014-06-16 12:28:52 -0400
commitbb39037fcbe07a4c4060764533b5c03a4018bf81 (patch)
tree3a0d501f187c548d6a4be2af8ab1765d4686c944 /tests/custom_migration_operations/operations.py
parent37a8f5aeedcfc5b4605960e5dc3d989456ce88b9 (diff)
downloaddjango-bb39037fcbe07a4c4060764533b5c03a4018bf81.tar.gz
Fixed #22788 -- Ensured custom migration operations can be written.
This inspects the migration operation, and if it is not in the django.db.migrations module, it adds the relevant imports to the migration writer and uses the correct class name.
Diffstat (limited to 'tests/custom_migration_operations/operations.py')
-rw-r--r--tests/custom_migration_operations/operations.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/custom_migration_operations/operations.py b/tests/custom_migration_operations/operations.py
new file mode 100644
index 0000000000..fc084f8412
--- /dev/null
+++ b/tests/custom_migration_operations/operations.py
@@ -0,0 +1,26 @@
+from django.db.migrations.operations.base import Operation
+
+
+class TestOperation(Operation):
+ def __init__(self):
+ pass
+
+ @property
+ def reversible(self):
+ return True
+
+ def state_forwards(self, app_label, state):
+ pass
+
+ def database_forwards(self, app_label, schema_editor, from_state, to_state):
+ pass
+
+ def state_backwards(self, app_label, state):
+ pass
+
+ def database_backwards(self, app_label, schema_editor, from_state, to_state):
+ pass
+
+
+class CreateModel(TestOperation):
+ pass