simplify IgnoreMigration operation
This commit is contained in:
1 parent
758468cbb8
commit
dcaa52a4da
1 file changed
+3
-6
@@ -14,23 +14,20 @@
|
||||
|
||||
from django.db.migrations.operations.base import Operation
|
||||
|
||||
IGNORE_MIGRATION_SQL = "select 1; -- dml ignores this migration"
|
||||
|
||||
|
||||
class IgnoreMigration(Operation):
|
||||
|
||||
reversible = True
|
||||
# Must be true to be generated through the sqlmigrate command
|
||||
reduces_to_sql = True
|
||||
reduces_to_sql = False
|
||||
|
||||
def state_forwards(self, app_label, state):
|
||||
pass
|
||||
|
||||
def database_forwards(self, app_label, schema_editor, from_state, to_state):
|
||||
schema_editor.execute(IGNORE_MIGRATION_SQL)
|
||||
pass
|
||||
|
||||
def database_backwards(self, app_label, schema_editor, from_state, to_state):
|
||||
schema_editor.execute(IGNORE_MIGRATION_SQL + " (reversed)")
|
||||
pass
|
||||
|
||||
def describe(self):
|
||||
return "The Django migration linter will ignore this migration"
|
||||
Reference in new issue
Block a user