Class CreateConstraintBuilder
Provides a fluent builder for defining database constraints as part of migration expressions. Use this builder to specify constraint details when creating constraints in database migrations.
Namespace: Umbraco.Cms.Infrastructure.Migrations.Expressions.Create.Constraint
Assembly: Umbraco.Infrastructure.dll
Syntax
public class CreateConstraintBuilder : ExpressionBuilderBase<CreateConstraintExpression>, ICreateConstraintOnTableBuilder, ICreateConstraintColumnsBuilder, IFluentBuilder
Constructors
View SourceCreateConstraintBuilder(CreateConstraintExpression)
Initializes a new instance of the CreateConstraintBuilder class using the specified constraint expression.
Declaration
public CreateConstraintBuilder(CreateConstraintExpression expression)
Parameters
| Type | Name | Description |
|---|---|---|
| CreateConstraintExpression | expression | The CreateConstraintExpression that defines the constraint to be created. |
Methods
View SourceColumn(string)
Specifies the name of the column to which the constraint will be applied in the migration.
Declaration
public IExecutableBuilder Column(string columnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | columnName | The name of the column to specify for the constraint. |
Returns
| Type | Description |
|---|---|
| IExecutableBuilder | An IExecutableBuilder to execute the next step in the migration. |
Columns(string[])
Specifies the constraint columns.
Declaration
public IExecutableBuilder Columns(string[] columnNames)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | columnNames |
Returns
| Type | Description |
|---|---|
| IExecutableBuilder |
OnTable(string)
Specifies the table name.
Declaration
public ICreateConstraintColumnsBuilder OnTable(string tableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | tableName |
Returns
| Type | Description |
|---|---|
| ICreateConstraintColumnsBuilder |