db.migrations.operations.RenameModel

class RenameModel(old_name, new_name) [source] Renames the model from an old name to a new one. You may have to manually add this if you change the model’s name and quite a few of its fields at once; to the autodetector, this will look like you deleted a model with the old name and added a new one with a different name, and the migration it creates will lose any data in the old table.

db.migrations.operations.RenameField

class RenameField(model_name, old_name, new_name) [source] Changes a field’s name (and, unless db_column is set, its column name).

db.migrations.operations.RemoveField

class RemoveField(model_name, name) [source] Removes a field from a model. Bear in mind that when reversed, this is actually adding a field to a model. The operation is reversible (apart from any data loss, which of course is irreversible) if the field is nullable or if it has a default value that can be used to populate the recreated column. If the field is not nullable and does not have a default value, the operation is irreversible.

db.migrations.operations.DeleteModel

class DeleteModel(name) [source] Deletes the model from the project history and its table from the database.

db.migrations.operations.CreateModel

class CreateModel(name, fields, options=None, bases=None, managers=None) [source] Creates a new model in the project history and a corresponding table in the database to match it. name is the model name, as would be written in the models.py file. fields is a list of 2-tuples of (field_name, field_instance). The field instance should be an unbound field (so just models.CharField(...), rather than a field taken from another model). options is an optional dictionary of values from the model’s M

db.migrations.operations.AlterUniqueTogether

class AlterUniqueTogether(name, unique_together) [source] Changes the model’s set of unique constraints (the unique_together option on the Meta subclass).

db.migrations.operations.AlterOrderWithRespectTo

class AlterOrderWithRespectTo(name, order_with_respect_to) [source] Makes or deletes the _order column needed for the order_with_respect_to option on the Meta subclass.

db.migrations.operations.AlterModelTable

class AlterModelTable(name, table) [source] Changes the model’s table name (the db_table option on the Meta subclass).

db.migrations.operations.AlterModelOptions

class AlterModelOptions(name, options) [source] Stores changes to miscellaneous model options (settings on a model’s Meta) like permissions and verbose_name. Does not affect the database, but persists these changes for RunPython instances to use. options should be a dictionary mapping option names to values.

db.migrations.operations.AlterModelManagers

class AlterModelManagers(name, managers) [source] Alters the managers that are available during migrations.