class documentation

class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):

Known subclasses: django.contrib.gis.db.backends.postgis.schema.PostGISSchemaEditor

View In Hierarchy

Undocumented

Method ​_alter​_column​_type​_sql Hook to specialize column type alteration for different backends, for cases when a creation type is different to an alteration type (e.g. SERIAL in PostgreSQL, PostGIS fields).
Method ​_alter​_field Perform a "physical" (non-ManyToMany) field update.
Method ​_create​_index​_sql Return the SQL statement to create the index for one or several fields or expressions. sql can be specified if the syntax differs from the standard (GIS indexes, ...).
Method ​_create​_like​_index​_sql Return the statement to create an index with varchar operator pattern when the column type is 'varchar' or 'text', otherwise return None.
Method ​_delete​_index​_sql Undocumented
Method ​_field​_base​_data​_types Undocumented
Method ​_field​_data​_type Undocumented
Method ​_field​_indexes​_sql Return a list of all index SQL statements for the specified field.
Method ​_index​_columns Undocumented
Method add​_index Add an index on a model.
Method quote​_value No summary
Method remove​_index Remove an index from a model.
Class Variable sql​_create​_column​_inline​_fk Undocumented
Class Variable sql​_create​_index Undocumented
Class Variable sql​_create​_index​_concurrently Undocumented
Class Variable sql​_create​_sequence Undocumented
Class Variable sql​_delete​_fk Undocumented
Class Variable sql​_delete​_index Undocumented
Class Variable sql​_delete​_index​_concurrently Undocumented
Class Variable sql​_delete​_procedure Undocumented
Class Variable sql​_delete​_sequence Undocumented
Class Variable sql​_set​_sequence​_max Undocumented
Class Variable sql​_set​_sequence​_owner Undocumented
Instance Variable sql​_alter​_column​_type Undocumented

Inherited from BaseDatabaseSchemaEditor:

Method add​_constraint Add a constraint to a model.
Method add​_field Create a field on a model. Usually involves adding a column, but may involve adding a table instead (for M2M fields).
Method alter​_db​_table Rename the table a model points to.
Method alter​_db​_tablespace Move a model's table between tablespaces.
Method alter​_field No summary
Method alter​_index​_together Deal with a model changing its index_together. The input index_togethers must be doubly-nested, not the single-nested ["foo", "bar"] format.
Method alter​_unique​_together Deal with a model changing its unique_together. The input unique_togethers must be doubly-nested, not the single-nested ["foo", "bar"] format.
Method create​_model Create a table and any accompanying indexes or unique constraints for the given model.
Method delete​_model Delete a model from the database.
Method execute Execute the given SQL statement, with optional parameters.
Method remove​_constraint Remove a constraint from a model.
Method remove​_field Remove a field from a model. Usually involves deleting a column, but for M2Ms may involve deleting a table.
Static Method ​_effective​_default Undocumented
Method __enter__ Undocumented
Method __exit__ Undocumented
Method __init__ Undocumented
Method ​_alter​_column​_collation​_sql Undocumented
Method ​_alter​_column​_default​_sql Hook to specialize column default alteration.
Method ​_alter​_column​_null​_sql Hook to specialize column null alteration.
Method ​_alter​_many​_to​_many Alter M2Ms to repoint their to= endpoints.
Method ​_check​_sql Undocumented
Method ​_collate​_sql Undocumented
Method ​_column​_default​_sql Return the SQL to use in a DEFAULT clause. The resulting string should contain a '%s' placeholder for a default value.
Method ​_constraint​_names Return all constraint names matching the columns and conditions.
Method ​_create​_check​_sql Undocumented
Method ​_create​_fk​_sql Undocumented
Method ​_create​_index​_name Generate a unique name for an index/unique constraint.
Method ​_create​_primary​_key​_sql Undocumented
Method ​_create​_unique​_sql Undocumented
Method ​_deferrable​_constraint​_sql Undocumented
Method ​_delete​_check​_sql Undocumented
Method ​_delete​_composed​_index Undocumented
Method ​_delete​_constraint​_sql Undocumented
Method ​_delete​_fk​_sql Undocumented
Method ​_delete​_primary​_key Undocumented
Method ​_delete​_primary​_key​_sql Undocumented
Method ​_delete​_unique​_sql Undocumented
Method ​_field​_became​_primary​_key Undocumented
Method ​_field​_should​_be​_altered Undocumented
Method ​_field​_should​_be​_indexed Undocumented
Method ​_fk​_constraint​_name Undocumented
Method ​_get​_index​_tablespace​_sql Undocumented
Method ​_index​_condition​_sql Undocumented
Method ​_index​_include​_sql Undocumented
Method ​_iter​_column​_sql Undocumented
Method ​_model​_indexes​_sql Return a list of all index SQL statements (field indexes, index_together, Meta.indexes) for the specified model.
Method ​_rename​_field​_sql Undocumented
Method ​_unique​_should​_be​_added Undocumented
Method ​_unique​_sql Undocumented
Method column​_sql Return the column definition for a field. The field must already have had set_attributes_from_name() called.
Method effective​_default Return a field's effective database default value.
Method prepare​_default Only used for backends which have requires_literal_defaults feature
Method quote​_name Undocumented
Method remove​_procedure Undocumented
Method skip​_default Some backends don't accept default values for certain columns types (i.e. MySQL longtext and longblob).
Method skip​_default​_on​_alter Some backends don't accept default values for certain columns types (i.e. MySQL longtext and longblob) in the ALTER COLUMN statement.
Method table​_sql Take a model and return its table definition.
Class Variable sql​_alter​_column Undocumented
Class Variable sql​_alter​_column​_collate Undocumented
Class Variable sql​_alter​_column​_default Undocumented
Class Variable sql​_alter​_column​_no​_default Undocumented
Class Variable sql​_alter​_column​_not​_null Undocumented
Class Variable sql​_alter​_column​_null Undocumented
Class Variable sql​_check​_constraint Undocumented
Class Variable sql​_constraint Undocumented
Class Variable sql​_create​_check Undocumented
Class Variable sql​_create​_column Undocumented
Class Variable sql​_create​_fk Undocumented
Class Variable sql​_create​_inline​_fk Undocumented
Class Variable sql​_create​_pk Undocumented
Class Variable sql​_create​_table Undocumented
Class Variable sql​_create​_unique Undocumented
Class Variable sql​_create​_unique​_index Undocumented
Class Variable sql​_delete​_column Undocumented
Class Variable sql​_delete​_constraint Undocumented
Class Variable sql​_delete​_table Undocumented
Class Variable sql​_rename​_column Undocumented
Class Variable sql​_rename​_table Undocumented
Class Variable sql​_retablespace​_table Undocumented
Class Variable sql​_unique​_constraint Undocumented
Class Variable sql​_update​_with​_default Undocumented
Instance Variable atomic Undocumented
Instance Variable atomic​_migration Undocumented
Instance Variable collect​_sql Undocumented
Instance Variable collected​_sql Undocumented
Instance Variable connection Undocumented
Instance Variable deferred​_sql Undocumented
def _alter_column_type_sql(self, model, old_field, new_field, new_type):

Hook to specialize column type alteration for different backends, for cases when a creation type is different to an alteration type (e.g. SERIAL in PostgreSQL, PostGIS fields).

Return a two-tuple of: an SQL fragment of (sql, params) to insert into an ALTER TABLE statement and a list of extra (sql, params) tuples to run once the field is altered.

def _alter_field(self, model, old_field, new_field, old_type, new_type, old_db_params, new_db_params, strict=False):
Perform a "physical" (non-ManyToMany) field update.
def _create_index_sql(self, model, *, fields=None, name=None, suffix='', using='', db_tablespace=None, col_suffixes=(), sql=None, opclasses=(), condition=None, concurrently=False, include=None, expressions=None):
Return the SQL statement to create the index for one or several fields or expressions. sql can be specified if the syntax differs from the standard (GIS indexes, ...).
def _create_like_index_sql(self, model, field):
Return the statement to create an index with varchar operator pattern when the column type is 'varchar' or 'text', otherwise return None.
def _delete_index_sql(self, model, name, sql=None, concurrently=False):
def _field_base_data_types(self, field):

Undocumented

def _field_data_type(self, field):

Undocumented

def _field_indexes_sql(self, model, field):
Return a list of all index SQL statements for the specified field.
def _index_columns(self, table, columns, col_suffixes, opclasses):
def add_index(self, model, index, concurrently=False):
def quote_value(self, value):
Return a quoted version of the value so it's safe to use in an SQL string. This is not safe against injection from user code; it is intended only for use in making SQL scripts or preparing default values for particularly tricky backends (defaults are not user-defined, though, so this is safe).
def remove_index(self, model, index, concurrently=False):
sql_create_column_inline_fk: str =
sql_create_index_concurrently: str =

Undocumented

sql_create_sequence: str =

Undocumented

sql_delete_fk: str =

Undocumented

sql_delete_index_concurrently: str =

Undocumented

sql_delete_sequence: str =

Undocumented

sql_set_sequence_max: str =

Undocumented

sql_set_sequence_owner: str =

Undocumented