class Migration:
Known subclasses: django.contrib.admin.migrations.0001_initial.Migration
, django.contrib.admin.migrations.0002_logentry_remove_auto_add.Migration
, django.contrib.admin.migrations.0003_logentry_add_action_flag_choices.Migration
, django.contrib.auth.migrations.0001_initial.Migration
, django.contrib.auth.migrations.0002_alter_permission_name_max_length.Migration
, django.contrib.auth.migrations.0003_alter_user_email_max_length.Migration
, django.contrib.auth.migrations.0004_alter_user_username_opts.Migration
, django.contrib.auth.migrations.0005_alter_user_last_login_null.Migration
, django.contrib.auth.migrations.0006_require_contenttypes_0002.Migration
, django.contrib.auth.migrations.0007_alter_validators_add_error_messages.Migration
, django.contrib.auth.migrations.0008_alter_user_username_max_length.Migration
, django.contrib.auth.migrations.0009_alter_user_last_name_max_length.Migration
, django.contrib.auth.migrations.0010_alter_group_name_max_length.Migration
, django.contrib.auth.migrations.0011_update_proxy_permissions.Migration
, django.contrib.auth.migrations.0012_alter_user_first_name_max_length.Migration
, django.contrib.contenttypes.migrations.0001_initial.Migration
, django.contrib.contenttypes.migrations.0002_remove_content_type_name.Migration
, django.contrib.flatpages.migrations.0001_initial.Migration
, django.contrib.redirects.migrations.0001_initial.Migration
, django.contrib.redirects.migrations.0002_alter_redirect_new_path_help_text.Migration
, django.contrib.sessions.migrations.0001_initial.Migration
, django.contrib.sites.migrations.0001_initial.Migration
, django.contrib.sites.migrations.0002_alter_domain_unique.Migration
The base class for all migrations.
Migration files will import this from django.db.migrations.Migration and subclass it as a class called Migration. It will have one or more of the following attributes:
- operations: A list of Operation instances, probably from django.db.migrations.operations
- dependencies: A list of tuples of (app_path, migration_name)
- run_before: A list of tuples of (app_path, migration_name)
- replaces: A list of migration_names
Note that all migrations come out of migrations and into the Loader or Graph as instances, having been initialized with their app label and name.
Method | __eq__ |
Undocumented |
Method | __hash__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | apply |
Take a project_state representing all migrations prior to this one and a schema_editor for a live database and apply the migration in a forwards order. |
Method | mutate_state |
Take a ProjectState and return a new one with the migration's operations applied to it. Preserve the original object state by default and return a mutated state from a copy. |
Method | suggest_name |
Suggest a name for the operations this migration might represent. Names are not guaranteed to be unique, but put some effort into the fallback name to avoid VCS conflicts if possible. |
Method | unapply |
Take a project_state representing all migrations prior to this one and a schema_editor for a live database and apply the migration in a reverse order. |
Class Variable | atomic |
Undocumented |
Class Variable | initial |
Undocumented |
Instance Variable | app_label |
Undocumented |
Instance Variable | dependencies |
Undocumented |
Instance Variable | name |
Undocumented |
Instance Variable | operations |
Undocumented |
Instance Variable | replaces |
Undocumented |
Instance Variable | run_before |
Undocumented |
Take a project_state representing all migrations prior to this one and a schema_editor for a live database and apply the migration in a forwards order.
Return the resulting project state for efficient reuse by following Migrations.
Take a project_state representing all migrations prior to this one and a schema_editor for a live database and apply the migration in a reverse order.
The backwards migration process consists of two phases:
django.contrib.admin.migrations.0001_initial.Migration
, django.contrib.admin.migrations.0002_logentry_remove_auto_add.Migration
, django.contrib.admin.migrations.0003_logentry_add_action_flag_choices.Migration
, django.contrib.auth.migrations.0001_initial.Migration
, django.contrib.auth.migrations.0002_alter_permission_name_max_length.Migration
, django.contrib.auth.migrations.0003_alter_user_email_max_length.Migration
, django.contrib.auth.migrations.0004_alter_user_username_opts.Migration
, django.contrib.auth.migrations.0005_alter_user_last_login_null.Migration
, django.contrib.auth.migrations.0006_require_contenttypes_0002.Migration
, django.contrib.auth.migrations.0007_alter_validators_add_error_messages.Migration
, django.contrib.auth.migrations.0008_alter_user_username_max_length.Migration
, django.contrib.auth.migrations.0009_alter_user_last_name_max_length.Migration
, django.contrib.auth.migrations.0010_alter_group_name_max_length.Migration
, django.contrib.auth.migrations.0011_update_proxy_permissions.Migration
, django.contrib.auth.migrations.0012_alter_user_first_name_max_length.Migration
, django.contrib.contenttypes.migrations.0001_initial.Migration
, django.contrib.contenttypes.migrations.0002_remove_content_type_name.Migration
, django.contrib.flatpages.migrations.0001_initial.Migration
, django.contrib.redirects.migrations.0001_initial.Migration
, django.contrib.redirects.migrations.0002_alter_redirect_new_path_help_text.Migration
, django.contrib.sessions.migrations.0001_initial.Migration
, django.contrib.sites.migrations.0001_initial.Migration
, django.contrib.sites.migrations.0002_alter_domain_unique.Migration
Undocumented
django.contrib.admin.migrations.0001_initial.Migration
, django.contrib.admin.migrations.0002_logentry_remove_auto_add.Migration
, django.contrib.admin.migrations.0003_logentry_add_action_flag_choices.Migration
, django.contrib.auth.migrations.0001_initial.Migration
, django.contrib.auth.migrations.0002_alter_permission_name_max_length.Migration
, django.contrib.auth.migrations.0003_alter_user_email_max_length.Migration
, django.contrib.auth.migrations.0004_alter_user_username_opts.Migration
, django.contrib.auth.migrations.0005_alter_user_last_login_null.Migration
, django.contrib.auth.migrations.0006_require_contenttypes_0002.Migration
, django.contrib.auth.migrations.0007_alter_validators_add_error_messages.Migration
, django.contrib.auth.migrations.0008_alter_user_username_max_length.Migration
, django.contrib.auth.migrations.0009_alter_user_last_name_max_length.Migration
, django.contrib.auth.migrations.0010_alter_group_name_max_length.Migration
, django.contrib.auth.migrations.0011_update_proxy_permissions.Migration
, django.contrib.auth.migrations.0012_alter_user_first_name_max_length.Migration
, django.contrib.contenttypes.migrations.0001_initial.Migration
, django.contrib.contenttypes.migrations.0002_remove_content_type_name.Migration
, django.contrib.flatpages.migrations.0001_initial.Migration
, django.contrib.redirects.migrations.0001_initial.Migration
, django.contrib.redirects.migrations.0002_alter_redirect_new_path_help_text.Migration
, django.contrib.sessions.migrations.0001_initial.Migration
, django.contrib.sites.migrations.0001_initial.Migration
, django.contrib.sites.migrations.0002_alter_domain_unique.Migration
Undocumented