Operation is a class within the django.db.migrations.operations.base module of the Django project.
django-migration-linter (PyPI package information) checks for backwards-incompatible changes in Django ORM schema migrations and warns you about them. The purpose of the project is to save time in older and larger projects by detecting field migrations that will be a problem so you do not run into issues later, and make it easier to enable continuous deployment configurations with database changes. There is a blog post on keeping Django database migrations backward compatible that goes into further detail on the tool.
The django-migration-linter project is open sourced under the Apache 2.0 license.
django-migration-linter / django_migration_linter / operations.py
# operations.py
from django.db.migrations.operations.base import Operation
class IgnoreMigration(Operation):
reversible = 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):
pass
def database_backwards(self, app_label, schema_editor, from_state, to_state):
pass
def describe(self):
return "The Django migration linter will ignore this migration"
## ... source file continues with no further Operation examples...