Class DeleteBuilder
Provides functionality to construct delete expressions used in database migration operations.
Inheritance
Namespace: Umbraco.Cms.Infrastructure.Migrations.Expressions.Delete
Assembly: Umbraco.Infrastructure.dll
Syntax
public class DeleteBuilder : IDeleteBuilder, IFluentBuilder
Constructors
View SourceDeleteBuilder(IMigrationContext)
Initializes a new instance of the DeleteBuilder class.
Declaration
public DeleteBuilder(IMigrationContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| IMigrationContext | context | The IMigrationContext to use for migration operations. |
Methods
View SourceColumn(string)
Specifies the column to be deleted in the current delete expression.
Declaration
public IDeleteColumnBuilder Column(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | columnName | The name of the column to delete. |
Returns
| Type | Description |
|---|---|
| IDeleteColumnBuilder | An Umbraco.Cms.Infrastructure.Migrations.Expressions.Delete.IDeleteColumnBuilder to continue building the delete expression. |
DefaultConstraint()
Begins building an expression to delete a default constraint from a table.
Declaration
public IDeleteDefaultConstraintOnTableBuilder DefaultConstraint()
Returns
| Type | Description |
|---|---|
| IDeleteDefaultConstraintOnTableBuilder | An Umbraco.Cms.Infrastructure.Migrations.Expressions.Delete.IDeleteDefaultConstraintOnTableBuilder to continue building the delete expression. |
ForeignKey()
Begins the definition of a delete operation for a foreign key constraint.
Declaration
public IDeleteForeignKeyFromTableBuilder ForeignKey()
Returns
| Type | Description |
|---|---|
| IDeleteForeignKeyFromTableBuilder | An IDeleteForeignKeyFromTableBuilder to continue building the delete expression. |
ForeignKey(string)
Specifies the foreign key to be deleted in the migration.
Declaration
public IDeleteForeignKeyOnTableBuilder ForeignKey(string foreignKeyName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | foreignKeyName | The name of the foreign key to delete. |
Returns
| Type | Description |
|---|---|
| IDeleteForeignKeyOnTableBuilder | An Umbraco.Cms.Infrastructure.Migrations.Expressions.Delete.IDeleteForeignKeyOnTableBuilder that allows further configuration of the delete operation. |
FromTable(string)
Specifies the table to delete data from.
Declaration
public IDeleteDataBuilder FromTable(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName |
Returns
| Type | Description |
|---|---|
| IDeleteDataBuilder |
Index()
Specifies the index to delete in the current table.
Declaration
public IDeleteIndexForTableBuilder Index()
Returns
| Type | Description |
|---|---|
| IDeleteIndexForTableBuilder | An IDeleteIndexForTableBuilder for further configuration of the index deletion. |
Index(string)
Specifies the name of the index to delete as part of a migration expression.
Declaration
public IDeleteIndexForTableBuilder Index(string indexName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | indexName | The name of the index to delete. |
Returns
| Type | Description |
|---|---|
| IDeleteIndexForTableBuilder | An Umbraco.Cms.Infrastructure.Migrations.Expressions.Delete.IDeleteIndexForTableBuilder to continue building the delete expression. |
KeysAndIndexes(string?, bool, bool)
Builds and executes an expression to delete keys and indexes from the specified table.
Declaration
public IExecutableBuilder KeysAndIndexes(string? tableName, bool local = true, bool foreign = true)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName | The name of the table from which to delete keys and indexes. |
| bool | local | If true, deletes local (primary and unique) keys and indexes. |
| bool | foreign | If true, deletes foreign keys and related indexes. |
Returns
| Type | Description |
|---|---|
| IExecutableBuilder | An IExecutableBuilder to execute the delete operation. |
KeysAndIndexes<TDto>(bool, bool)
Builds a Delete Keys and Indexes expression, and executes.
Declaration
public IExecutableBuilder KeysAndIndexes<TDto>(bool local = true, bool foreign = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | local | |
| bool | foreign |
Returns
| Type | Description |
|---|---|
| IExecutableBuilder |
Type Parameters
| Name | Description |
|---|---|
| TDto |
PrimaryKey(string)
Specifies the primary key to delete in the migration expression.
Declaration
public IDeleteConstraintBuilder PrimaryKey(string primaryKeyName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | primaryKeyName | The name of the primary key to be deleted. |
Returns
| Type | Description |
|---|---|
| IDeleteConstraintBuilder | An IDeleteConstraintBuilder for further constraint configuration. |
Table(string)
Specifies the table to delete.
Declaration
public IExecutableBuilder Table(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName |
Returns
| Type | Description |
|---|---|
| IExecutableBuilder |
UniqueConstraint(string)
Specifies which unique constraint should be deleted from the database schema.
Declaration
public IDeleteConstraintBuilder UniqueConstraint(string constraintName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | constraintName | The name of the unique constraint to delete. |
Returns
| Type | Description |
|---|---|
| IDeleteConstraintBuilder | An Umbraco.Cms.Infrastructure.Migrations.Expressions.Delete.IDeleteConstraintBuilder to continue building the delete expression. |