Skip to main content

Migration

This class defines a database migration that modifies the domain field of the site model. It updates the field to include a unique constraint, a specific maximum length, and a domain name validator while maintaining compatibility with the initial sites migration.

Attributes

AttributeTypeDescription
dependencieslist = [("sites", "0001_initial")]A list of migration identifiers that must be applied before this migration can be executed.
operationslistA list of migration operation instances that define the schema changes to be applied to the database.

Methods


dependencies()

def dependencies() - > list

Defines the list of migration identifiers that must be applied before this migration can be executed.

Returns

TypeDescription
listA list of tuples containing the app name and migration name dependencies.

operations()

def operations() - > list

Specifies the list of database operations to be performed, such as altering the 'domain' field on the 'site' model to enforce uniqueness and validation.

Returns

TypeDescription
listA list of migration operation instances to be applied to the database schema.