Interface IColumnOptionBuilder<TNext, TNextFk>
Provides a fluent builder interface for configuring column options within a database migration expression.
Namespace: Umbraco.Cms.Infrastructure.Migrations.Expressions.Common
Assembly: Umbraco.Infrastructure.dll
Syntax
public interface IColumnOptionBuilder<out TNext, out TNextFk> : IFluentBuilder where TNext : IFluentBuilder where TNextFk : IFluentBuilder
Type Parameters
| Name | Description |
|---|---|
| TNext | |
| TNextFk |
Methods
View SourceForeignKey()
Configures the current column as a foreign key referencing another table.
Declaration
TNextFk ForeignKey()
Returns
| Type | Description |
|---|---|
| TNextFk | The next step in the column option builder chain. |
ForeignKey(string, string)
Specifies a foreign key constraint for the current column, referencing a primary key in another table.
Declaration
TNextFk ForeignKey(string primaryTableName, string primaryColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | primaryTableName | The name of the table containing the primary key to reference. |
| string | primaryColumnName | The name of the primary key column in the referenced table. |
Returns
| Type | Description |
|---|---|
| TNextFk | An object representing the next step in the column option builder chain, allowing further configuration. |
ForeignKey(string, string, string)
Specifies a foreign key constraint for the current column, referencing a primary key in another table.
Declaration
TNextFk ForeignKey(string foreignKeyName, string primaryTableName, string primaryColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | foreignKeyName | The name of the foreign key constraint. |
| string | primaryTableName | The name of the table containing the primary key to reference. |
| string | primaryColumnName | The name of the primary key column in the referenced table. |
Returns
| Type | Description |
|---|---|
| TNextFk | An object representing the next step in the column option builder chain, allowing further configuration. |
ForeignKey(string, string, string, string)
Specifies a foreign key constraint for the current column, referencing a primary key in another table.
Declaration
TNextFk ForeignKey(string foreignKeyName, string primaryTableSchema, string primaryTableName, string primaryColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | foreignKeyName | The name of the foreign key constraint. |
| string | primaryTableSchema | The schema of the table containing the primary key to reference. |
| string | primaryTableName | The name of the table containing the primary key to reference. |
| string | primaryColumnName | The name of the primary key column in the referenced table. |
Returns
| Type | Description |
|---|---|
| TNextFk | An object representing the next step in the column option builder chain, allowing further configuration. |
Identity()
Marks the column as an identity column, meaning its value will be automatically generated by the database.
Declaration
TNext Identity()
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder chain. |
Indexed()
Marks the column as indexed by creating a non-unique index on it.
Declaration
TNext Indexed()
Returns
| Type | Description |
|---|---|
| TNext | The next builder in the expression chain. |
Indexed(string)
Marks the column as indexed and assigns the specified index name.
Declaration
TNext Indexed(string indexName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | indexName | The name to assign to the created index. |
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder chain. |
NotNullable()
Marks the column as not nullable.
Declaration
TNext NotNullable()
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder chain. |
Nullable()
Sets the column as nullable, allowing it to store null values.
Declaration
TNext Nullable()
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder chain. |
PrimaryKey()
Specifies that the column should be defined as a primary key in the database schema.
Declaration
TNext PrimaryKey()
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder chain. |
PrimaryKey(string)
Sets a primary key constraint on the column with the specified constraint name.
Declaration
TNext PrimaryKey(string primaryKeyName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | primaryKeyName | The name to assign to the primary key constraint. |
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder chain. |
ReferencedBy(string, string)
Specifies that this column is the target of a foreign key from another table.
Declaration
TNextFk ReferencedBy(string foreignTableName, string foreignColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | foreignTableName | The name of the table containing the foreign key that references this column. |
| string | foreignColumnName | The name of the column in the foreign table that references this column. |
Returns
| Type | Description |
|---|---|
| TNextFk | An object representing the next step in the migration expression. |
ReferencedBy(string, string, string)
Specifies that this column is referenced by a foreign key constraint from another table.
Declaration
TNextFk ReferencedBy(string foreignKeyName, string foreignTableName, string foreignColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | foreignKeyName | The name of the foreign key constraint that references this column. |
| string | foreignTableName | The name of the table containing the foreign key. |
| string | foreignColumnName | The name of the column in the foreign table that references this column. |
Returns
| Type | Description |
|---|---|
| TNextFk | The builder for configuring the foreign key relationship. |
ReferencedBy(string, string, string, string)
Specifies that this column is the target of a foreign key from another table.
Declaration
TNextFk ReferencedBy(string foreignKeyName, string foreignTableSchema, string foreignTableName, string foreignColumnName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | foreignKeyName | The name of the foreign key constraint. |
| string | foreignTableSchema | The schema of the table containing the foreign key that references this column. |
| string | foreignTableName | The name of the table containing the foreign key that references this column. |
| string | foreignColumnName | The name of the column in the foreign table that references this column. |
Returns
| Type | Description |
|---|---|
| TNextFk | An object representing the next step in the migration expression. |
Unique()
Specifies that the column should have a unique constraint applied, ensuring all values in the column are distinct.
Declaration
TNext Unique()
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder expression chain. |
Unique(string)
Applies a unique constraint to the column using the specified index name, ensuring all values in the column are distinct.
Declaration
TNext Unique(string indexName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | indexName | The name of the unique index to create for the column. |
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder expression chain. |
WithDefault(SystemMethods)
Sets the default value for the column using the specified SystemMethods method.
Declaration
TNext WithDefault(SystemMethods method)
Parameters
| Type | Name | Description |
|---|---|---|
| SystemMethods | method | The SystemMethods value representing the system method to use as the column's default value. |
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder chain. |
WithDefaultValue(object)
Specifies a default value for the column being defined.
Declaration
TNext WithDefaultValue(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The default value to assign to the column if no value is provided during insert operations. |
Returns
| Type | Description |
|---|---|
| TNext | The next step in the column option builder chain. |