RemoveCollation
Remove a collation.
Attributes
| Attribute | Type | Description |
|---|---|---|
| category | [OperationCategory](../../../db/migrations/operations/base/operationcategory.md?sid=django_db_migrations_operations_base_operationcategory) = OperationCategory.REMOVAL | The operational category used to classify this migration action as a removal operation. |
Methods
database_forwards()
@classmethod
def database_forwards(
app_label: string,
schema_editor: [BaseDatabaseSchemaEditor](../../../db/backends/base/schema/basedatabaseschemaeditor.md?sid=django_db_backends_base_schema_basedatabaseschemaeditor),
from_state: [ProjectState](../../../db/migrations/state/projectstate.md?sid=django_db_migrations_state_projectstate),
to_state: [ProjectState](../../../db/migrations/state/projectstate.md?sid=django_db_migrations_state_projectstate)
) - > null
Executes the collation removal on the database if the connection is PostgreSQL and migration is allowed.
Parameters
| Name | Type | Description |
|---|---|---|
| app_label | string | The label of the application being migrated to determine migration eligibility. |
| schema_editor | [BaseDatabaseSchemaEditor](../../../db/backends/base/schema/basedatabaseschemaeditor.md?sid=django_db_backends_base_schema_basedatabaseschemaeditor) | The database abstraction layer used to execute the SQL commands for dropping the collation. |
| from_state | [ProjectState](../../../db/migrations/state/projectstate.md?sid=django_db_migrations_state_projectstate) | The state of the project before the operation is applied. |
| to_state | [ProjectState](../../../db/migrations/state/projectstate.md?sid=django_db_migrations_state_projectstate) | The state of the project after the operation is applied. |
Returns
| Type | Description |
|---|---|
null | Nothing is returned; the method performs an in-place database schema modification. |
database_backwards()
@classmethod
def database_backwards(
app_label: string,
schema_editor: [BaseDatabaseSchemaEditor](../../../db/backends/base/schema/basedatabaseschemaeditor.md?sid=django_db_backends_base_schema_basedatabaseschemaeditor),
from_state: [ProjectState](../../../db/migrations/state/projectstate.md?sid=django_db_migrations_state_projectstate),
to_state: [ProjectState](../../../db/migrations/state/projectstate.md?sid=django_db_migrations_state_projectstate)
) - > null
Reverts the removal by re-creating the collation in the database schema.
Parameters
| Name | Type | Description |
|---|---|---|
| app_label | string | The label of the application being migrated to determine migration eligibility. |
| schema_editor | [BaseDatabaseSchemaEditor](../../../db/backends/base/schema/basedatabaseschemaeditor.md?sid=django_db_backends_base_schema_basedatabaseschemaeditor) | The database abstraction layer used to execute the SQL commands for creating the collation. |
| from_state | [ProjectState](../../../db/migrations/state/projectstate.md?sid=django_db_migrations_state_projectstate) | The state of the project before the reversal. |
| to_state | [ProjectState](../../../db/migrations/state/projectstate.md?sid=django_db_migrations_state_projectstate) | The state of the project after the reversal. |
Returns
| Type | Description |
|---|---|
null | Nothing is returned; the method restores the previous database state. |
describe()
@classmethod
def describe() - > string
Returns a human-readable string describing the collation removal operation for migration logs.
Returns
| Type | Description |
|---|---|
string | A formatted string containing the name of the collation being removed. |
migration_name_fragment()
@classmethod
def migration_name_fragment() - > string
Generates a lowercase string fragment used to automatically name the migration file.
Returns
| Type | Description |
|---|---|
string | A snake_case string identifying the operation and the specific collation name. |