Class MigrationBuilder
- Namespace
- Microsoft.EntityFrameworkCore.Migrations
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
A builder providing a fluentish API for building MigrationOperations.
public class MigrationBuilder
- Inheritance
-
MigrationBuilder
- Inherited Members
Constructors
MigrationBuilder(string)
Creates a new instance of the builder.
public MigrationBuilder(string activeProvider)
Parameters
activeProvider
stringThe name of the database provider being used.
Properties
ActiveProvider
The name of the database provider being used.
public virtual string ActiveProvider { get; }
Property Value
Operations
The list of MigrationOperations being built.
public virtual List<MigrationOperation> Operations { get; }
Property Value
Methods
AddCheckConstraint(string, string, string, string)
Builds an AddCheckConstraintOperation to add a new check constraint to a table.
public virtual OperationBuilder<AddCheckConstraintOperation> AddCheckConstraint(string name, string table, string sql, string schema = null)
Parameters
name
stringThe check constraint name.
table
stringThe name of the table for the check constraint.
sql
stringThe constraint sql for the check constraint.
schema
stringThe schema that contains the check constraint, or null to use the default schema.
Returns
- OperationBuilder<AddCheckConstraintOperation>
A builder to allow annotations to be added to the operation.
AddColumn<T>(string, string, string, bool?, int?, bool, string, bool, object, string, string, bool?, string, string, int?, int?, bool?)
Builds an AddColumnOperation to add a new column to a table.
public virtual OperationBuilder<AddColumnOperation> AddColumn<T>(string name, string table, string type = null, bool? unicode = null, int? maxLength = null, bool rowVersion = false, string schema = null, bool nullable = false, object defaultValue = null, string defaultValueSql = null, string computedColumnSql = null, bool? fixedLength = null, string comment = null, string collation = null, int? precision = null, int? scale = null, bool? stored = null)
Parameters
name
stringThe column name.
table
stringThe name of the table that contains the column.
type
stringThe store/database type of the column.
unicode
bool?Indicates whether or not the column can contain Unicode data, or null if not specified or not applicable.
maxLength
int?The maximum length of data that can be stored in the column, or null if not specified or not applicable.
rowVersion
boolIndicates whether or not the column acts as an automatic concurrency token, such as a rowversion/timestamp column in SQL Server.
schema
stringThe schema that contains the table, or null if the default schema should be used.
nullable
boolIndicates whether or not the column can store null values.
defaultValue
objectThe default value for the column.
defaultValueSql
stringThe SQL expression to use for the column's default constraint.
computedColumnSql
stringThe SQL expression to use to compute the column value.
fixedLength
bool?Indicates whether or not the column is constrained to fixed-length data.
comment
stringA comment to associate with the column.
collation
stringA collation to apply to the column.
precision
int?The maximum number of digits that is allowed in this column, or null if not specified or not applicable.
scale
int?The maximum number of decimal places that is allowed in this column, or null if not specified or not applicable.
stored
bool?Whether the value of the computed column is stored in the database or not.
Returns
- OperationBuilder<AddColumnOperation>
A builder to allow annotations to be added to the operation.
Type Parameters
T
The CLR type that the column is mapped to.
AddForeignKey(string, string, string, string, string, string, string, ReferentialAction, ReferentialAction)
Builds an AddForeignKeyOperation to add a new foreign key to a table.
public virtual OperationBuilder<AddForeignKeyOperation> AddForeignKey(string name, string table, string column, string principalTable, string schema = null, string principalSchema = null, string principalColumn = null, ReferentialAction onUpdate = ReferentialAction.NoAction, ReferentialAction onDelete = ReferentialAction.NoAction)
Parameters
name
stringThe foreign key constraint name.
table
stringThe table that contains the foreign key.
column
stringThe column that is constrained.
principalTable
stringThe table to which the foreign key is constrained.
schema
stringThe schema that contains the table, or null if the default schema should be used.
principalSchema
stringThe schema that contains principal table, or null if the default schema should be used.
principalColumn
stringThe column to which the foreign key column is constrained, or null to constrain to the primary key column.
onUpdate
ReferentialActionThe action to take on updates.
onDelete
ReferentialActionThe action to take on deletes.
Returns
- OperationBuilder<AddForeignKeyOperation>
A builder to allow annotations to be added to the operation.
AddForeignKey(string, string, string[], string, string, string, string[], ReferentialAction, ReferentialAction)
Builds an AddForeignKeyOperation to add a new composite (multi-column) foreign key to a table.
public virtual OperationBuilder<AddForeignKeyOperation> AddForeignKey(string name, string table, string[] columns, string principalTable, string schema = null, string principalSchema = null, string[] principalColumns = null, ReferentialAction onUpdate = ReferentialAction.NoAction, ReferentialAction onDelete = ReferentialAction.NoAction)
Parameters
name
stringThe foreign key constraint name.
table
stringThe table that contains the foreign key.
columns
string[]The ordered list of columns that are constrained.
principalTable
stringThe table to which the foreign key is constrained.
schema
stringThe schema that contains the table, or null if the default schema should be used.
principalSchema
stringThe schema that contains principal table, or null if the default schema should be used.
principalColumns
string[]The columns to which the foreign key columns are constrained, or null to constrain to the primary key column.
onUpdate
ReferentialActionThe action to take on updates.
onDelete
ReferentialActionThe action to take on deletes.
Returns
- OperationBuilder<AddForeignKeyOperation>
A builder to allow annotations to be added to the operation.
AddPrimaryKey(string, string, string, string)
Builds an AddPrimaryKeyOperation to add a new primary key to a table.
public virtual OperationBuilder<AddPrimaryKeyOperation> AddPrimaryKey(string name, string table, string column, string schema = null)
Parameters
name
stringThe primary key constraint name.
table
stringThe table that will contain the primary key.
column
stringThe column that constitutes the primary key.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<AddPrimaryKeyOperation>
A builder to allow annotations to be added to the operation.
AddPrimaryKey(string, string, string[], string)
Builds an AddPrimaryKeyOperation to add a new composite (multi-column) primary key to a table.
public virtual OperationBuilder<AddPrimaryKeyOperation> AddPrimaryKey(string name, string table, string[] columns, string schema = null)
Parameters
name
stringThe primary key constraint name.
table
stringThe table that will contain the primary key.
columns
string[]The ordered list of columns that constitute the primary key.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<AddPrimaryKeyOperation>
A builder to allow annotations to be added to the operation.
AddUniqueConstraint(string, string, string, string)
Builds an AddUniqueConstraintOperation to add a new unique constraint to a table.
public virtual OperationBuilder<AddUniqueConstraintOperation> AddUniqueConstraint(string name, string table, string column, string schema = null)
Parameters
name
stringThe constraint name.
table
stringThe table that will contain the constraint.
column
stringThe column that is constrained.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<AddUniqueConstraintOperation>
A builder to allow annotations to be added to the operation.
AddUniqueConstraint(string, string, string[], string)
Builds an AddUniqueConstraintOperation to add a new composite (multi-column) unique constraint to a table.
public virtual OperationBuilder<AddUniqueConstraintOperation> AddUniqueConstraint(string name, string table, string[] columns, string schema = null)
Parameters
name
stringThe constraint name.
table
stringThe table that will contain the constraint.
columns
string[]The ordered list of columns that are constrained.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<AddUniqueConstraintOperation>
A builder to allow annotations to be added to the operation.
AlterColumn<T>(string, string, string, bool?, int?, bool, string, bool, object, string, string, Type, string, bool?, int?, bool, bool, object, string, string, bool?, bool?, string, string, string, string, int?, int?, int?, int?, bool?, bool?)
Builds an AlterColumnOperation to alter an existing column.
public virtual AlterOperationBuilder<AlterColumnOperation> AlterColumn<T>(string name, string table, string type = null, bool? unicode = null, int? maxLength = null, bool rowVersion = false, string schema = null, bool nullable = false, object defaultValue = null, string defaultValueSql = null, string computedColumnSql = null, Type oldClrType = null, string oldType = null, bool? oldUnicode = null, int? oldMaxLength = null, bool oldRowVersion = false, bool oldNullable = false, object oldDefaultValue = null, string oldDefaultValueSql = null, string oldComputedColumnSql = null, bool? fixedLength = null, bool? oldFixedLength = null, string comment = null, string oldComment = null, string collation = null, string oldCollation = null, int? precision = null, int? oldPrecision = null, int? scale = null, int? oldScale = null, bool? stored = null, bool? oldStored = null)
Parameters
name
stringThe column name.
table
stringThe name of the table that contains the column.
type
stringThe store/database type of the column.
unicode
bool?Indicates whether or not the column can contain Unicode data, or null if not specified or not applicable.
maxLength
int?The maximum length of data that can be stored in the column, or null if not specified or not applicable.
rowVersion
boolIndicates whether or not the column acts as an automatic concurrency token, such as a rowversion/timestamp column in SQL Server.
schema
stringThe schema that contains the table, or null if the default schema should be used.
nullable
boolIndicates whether or not the column can store null values.
defaultValue
objectThe default value for the column.
defaultValueSql
stringThe SQL expression to use for the column's default constraint.
computedColumnSql
stringThe SQL expression to use to compute the column value.
oldClrType
TypeThe CLR type that the column was previously mapped to. Can be null, in which case previous value is considered unknown.
oldType
stringThe previous store/database type of the column. Can be null, in which case previous value is considered unknown.
oldUnicode
bool?Indicates whether or not the column could previously contain Unicode data, or null if not specified or not applicable.
oldMaxLength
int?The previous maximum length of data that can be stored in the column, or null if not specified or not applicable.
oldRowVersion
boolIndicates whether or not the column previously acted as an automatic concurrency token, such as a rowversion/timestamp column in SQL Server. Can be null, in which case previous value is considered unknown.
oldNullable
boolIndicates whether or not the column could previously store null values. Can be null, in which case previous value is considered unknown.
oldDefaultValue
objectThe previous default value for the column. Can be null, in which case previous value is considered unknown.
oldDefaultValueSql
stringThe previous SQL expression used for the column's default constraint. Can be null, in which case previous value is considered unknown.
oldComputedColumnSql
stringThe previous SQL expression used to compute the column value. Can be null, in which case previous value is considered unknown.
fixedLength
bool?Indicates whether or not the column is constrained to fixed-length data.
oldFixedLength
bool?Indicates whether or not the column was previously constrained to fixed-length data.
comment
stringA comment to associate with the column.
oldComment
stringThe previous comment to associate with the column.
collation
stringA collation to apply to the column.
oldCollation
stringThe previous collation to apply to the column.
precision
int?The maximum number of digits that is allowed in this column, or null if not specified or not applicable.
oldPrecision
int?The previous maximum number of digits that is allowed in this column, or null if not specified or not applicable.
scale
int?The maximum number of decimal places that is allowed in this column, or null if not specified or not applicable.
oldScale
int?The previous maximum number of decimal places that is allowed in this column, or null if not specified or not applicable.
stored
bool?Whether the value of the computed column is stored in the database or not.
oldStored
bool?Whether the value of the previous computed column was stored in the database or not.
Returns
- AlterOperationBuilder<AlterColumnOperation>
A builder to allow annotations to be added to the operation.
Type Parameters
T
The CLR type that the column is mapped to.
AlterDatabase(string, string)
Builds an AlterDatabaseOperation to alter an existing database.
public virtual AlterOperationBuilder<AlterDatabaseOperation> AlterDatabase(string collation = null, string oldCollation = null)
Parameters
collation
stringA collation to apply to the column.
oldCollation
stringThe previous collation to apply to the column.
Returns
- AlterOperationBuilder<AlterDatabaseOperation>
A builder to allow annotations to be added to the operation.
AlterSequence(string, string, int, long?, long?, bool, int, long?, long?, bool)
Builds an AlterSequenceOperation to alter an existing sequence.
public virtual AlterOperationBuilder<AlterSequenceOperation> AlterSequence(string name, string schema = null, int incrementBy = 1, long? minValue = null, long? maxValue = null, bool cyclic = false, int oldIncrementBy = 1, long? oldMinValue = null, long? oldMaxValue = null, bool oldCyclic = false)
Parameters
name
stringThe sequence name.
schema
stringThe schema that contains the sequence, or null to use the default schema.
incrementBy
intThe amount to increment by when generating the next value in the sequence, defaulting to 1.
minValue
long?The minimum value of the sequence, or null if not specified.
maxValue
long?The maximum value of the sequence, or null if not specified.
cyclic
boolIndicates whether or not the sequence will re-start when the maximum value is reached.
oldIncrementBy
intThe previous amount to increment by when generating the next value in the sequence, defaulting to 1.
oldMinValue
long?The previous minimum value of the sequence, or null if not specified.
oldMaxValue
long?The previous maximum value of the sequence, or null if not specified.
oldCyclic
boolIndicates whether or not the sequence would previously re-start when the maximum value is reached.
Returns
- AlterOperationBuilder<AlterSequenceOperation>
A builder to allow annotations to be added to the operation.
AlterTable(string, string, string, string)
Builds an AlterTableOperation to alter an existing table.
public virtual AlterOperationBuilder<AlterTableOperation> AlterTable(string name, string schema = null, string comment = null, string oldComment = null)
Parameters
name
stringThe table name.
schema
stringThe schema that contains the table, or null to use the default schema.
comment
stringA comment to associate with the table.
oldComment
stringThe previous comment to associate with the table.
Returns
- AlterOperationBuilder<AlterTableOperation>
A builder to allow annotations to be added to the operation.
CreateIndex(string, string, string, string, bool, string)
Builds an CreateIndexOperation to create a new index.
public virtual OperationBuilder<CreateIndexOperation> CreateIndex(string name, string table, string column, string schema = null, bool unique = false, string filter = null)
Parameters
name
stringThe index name.
table
stringThe table that contains the index.
column
stringThe column that is indexed.
schema
stringThe schema that contains the table, or null to use the default schema.
unique
boolIndicates whether or not the index enforces uniqueness.
filter
stringThe filter to apply to the index, or null for no filter.
Returns
- OperationBuilder<CreateIndexOperation>
A builder to allow annotations to be added to the operation.
CreateIndex(string, string, string[], string, bool, string)
Builds an CreateIndexOperation to create a new composite (multi-column) index.
public virtual OperationBuilder<CreateIndexOperation> CreateIndex(string name, string table, string[] columns, string schema = null, bool unique = false, string filter = null)
Parameters
name
stringThe index name.
table
stringThe table that contains the index.
columns
string[]The ordered list of columns that are indexed.
schema
stringThe schema that contains the table, or null to use the default schema.
unique
boolIndicates whether or not the index enforces uniqueness.
filter
stringThe filter to apply to the index, or null for no filter.
Returns
- OperationBuilder<CreateIndexOperation>
A builder to allow annotations to be added to the operation.
CreateSequence(string, string, long, int, long?, long?, bool)
Builds an CreateSequenceOperation to create a new sequence.
public virtual OperationBuilder<CreateSequenceOperation> CreateSequence(string name, string schema = null, long startValue = 1, int incrementBy = 1, long? minValue = null, long? maxValue = null, bool cyclic = false)
Parameters
name
stringThe sequence name.
schema
stringThe schema that contains the sequence, or null to use the default schema.
startValue
longThe value at which the sequence will start, defaulting to 1.
incrementBy
intThe amount to increment by when generating the next value in the sequence, defaulting to 1.
minValue
long?The minimum value of the sequence, or null if not specified.
maxValue
long?The maximum value of the sequence, or null if not specified.
cyclic
boolIndicates whether or not the sequence will re-start when the maximum value is reached.
Returns
- OperationBuilder<CreateSequenceOperation>
A builder to allow annotations to be added to the operation.
CreateSequence<T>(string, string, long, int, long?, long?, bool)
Builds an CreateSequenceOperation to create a new sequence.
public virtual OperationBuilder<CreateSequenceOperation> CreateSequence<T>(string name, string schema = null, long startValue = 1, int incrementBy = 1, long? minValue = null, long? maxValue = null, bool cyclic = false)
Parameters
name
stringThe sequence name.
schema
stringThe schema that contains the sequence, or null to use the default schema.
startValue
longThe value at which the sequence will start, defaulting to 1.
incrementBy
intThe amount to increment by when generating the next value in the sequence, defaulting to 1.
minValue
long?The minimum value of the sequence, or null if not specified.
maxValue
long?The maximum value of the sequence, or null if not specified.
cyclic
boolIndicates whether or not the sequence will re-start when the maximum value is reached.
Returns
- OperationBuilder<CreateSequenceOperation>
A builder to allow annotations to be added to the operation.
Type Parameters
T
The CLR type of the values generated by the sequence.
CreateTable<TColumns>(string, Func<ColumnsBuilder, TColumns>, string, Action<CreateTableBuilder<TColumns>>, string)
Builds an CreateTableOperation to create a new table.
public virtual CreateTableBuilder<TColumns> CreateTable<TColumns>(string name, Func<ColumnsBuilder, TColumns> columns, string schema = null, Action<CreateTableBuilder<TColumns>> constraints = null, string comment = null)
Parameters
name
stringThe name of the table.
columns
Func<ColumnsBuilder, TColumns>A delegate using a ColumnsBuilder to create an anonymous type configuring the columns of the table.
schema
stringThe schema that contains the table, or null to use the default schema.
constraints
Action<CreateTableBuilder<TColumns>>A delegate allowing constraints to be applied over the columns configured by the 'columns' delegate above.
comment
stringA comment to be applied to the table.
Returns
- CreateTableBuilder<TColumns>
A CreateTableBuilder<TColumns> to allow further configuration to be chained.
Type Parameters
TColumns
Type of a typically anonymous type for building columns.
DeleteData(string, string, object, string)
Builds an DeleteDataOperation to delete a single row of seed data.
public virtual OperationBuilder<DeleteDataOperation> DeleteData(string table, string keyColumn, object keyValue, string schema = null)
Parameters
table
stringThe table from which the data will be deleted.
keyColumn
stringThe name of the key column used to select the row to delete.
keyValue
objectThe key value of the row to delete.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DeleteDataOperation>
A builder to allow annotations to be added to the operation.
DeleteData(string, string, object[], string)
Builds an DeleteDataOperation to delete multiple rows of seed data.
public virtual OperationBuilder<DeleteDataOperation> DeleteData(string table, string keyColumn, object[] keyValues, string schema = null)
Parameters
table
stringThe table from which the data will be deleted.
keyColumn
stringThe name of the key column used to select the row to delete.
keyValues
object[]The key values of the rows to delete, one value per row.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DeleteDataOperation>
A builder to allow annotations to be added to the operation.
DeleteData(string, string, string, object, string)
Builds an DeleteDataOperation to delete a single row of seed data.
public virtual OperationBuilder<DeleteDataOperation> DeleteData(string table, string keyColumn, string keyColumnType, object keyValue, string schema = null)
Parameters
table
stringThe table from which the data will be deleted.
keyColumn
stringThe name of the key column used to select the row to delete.
keyColumnType
stringThe store type for the column that will be used to identify the rows that should be deleted.
keyValue
objectThe key value of the row to delete.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DeleteDataOperation>
A builder to allow annotations to be added to the operation.
DeleteData(string, string, string, object[], string)
Builds an DeleteDataOperation to delete multiple rows of seed data.
public virtual OperationBuilder<DeleteDataOperation> DeleteData(string table, string keyColumn, string keyColumnType, object[] keyValues, string schema = null)
Parameters
table
stringThe table from which the data will be deleted.
keyColumn
stringThe name of the key column used to select the row to delete.
keyColumnType
stringThe store type for the column that will be used to identify the rows that should be deleted.
keyValues
object[]The key values of the rows to delete, one value per row.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DeleteDataOperation>
A builder to allow annotations to be added to the operation.
DeleteData(string, string[], object[,], string)
Builds an DeleteDataOperation to delete multiple rows of seed data from a table with a composite (multi-column) key.
public virtual OperationBuilder<DeleteDataOperation> DeleteData(string table, string[] keyColumns, object[,] keyValues, string schema = null)
Parameters
table
stringThe table from which the data will be deleted.
keyColumns
string[]The names of the key columns used to select the rows to delete.
keyValues
object[,]The key values of the rows to delete, where each element of the outer array represents a row, and each inner array contains values for each of the key columns in 'keyColumns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DeleteDataOperation>
A builder to allow annotations to be added to the operation.
DeleteData(string, string[], object[], string)
Builds an DeleteDataOperation to delete a single row of seed data from a table with a composite (multi-column) key.
public virtual OperationBuilder<DeleteDataOperation> DeleteData(string table, string[] keyColumns, object[] keyValues, string schema = null)
Parameters
table
stringThe table from which the data will be deleted.
keyColumns
string[]The names of the key columns used to select the row to delete.
keyValues
object[]The key values of the row to delete, one value for each column in 'keyColumns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DeleteDataOperation>
A builder to allow annotations to be added to the operation.
DeleteData(string, string[], string[], object[,], string)
Builds an DeleteDataOperation to delete multiple rows of seed data from a table with a composite (multi-column) key.
public virtual OperationBuilder<DeleteDataOperation> DeleteData(string table, string[] keyColumns, string[] keyColumnTypes, object[,] keyValues, string schema = null)
Parameters
table
stringThe table from which the data will be deleted.
keyColumns
string[]The names of the key columns used to select the rows to delete.
keyColumnTypes
string[]The store types for the columns that will be used to identify the rows that should be deleted.
keyValues
object[,]The key values of the rows to delete, where each element of the outer array represents a row, and each inner array contains values for each of the key columns in 'keyColumns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DeleteDataOperation>
A builder to allow annotations to be added to the operation.
DeleteData(string, string[], string[], object[], string)
Builds an DeleteDataOperation to delete a single row of seed data from a table with a composite (multi-column) key.
public virtual OperationBuilder<DeleteDataOperation> DeleteData(string table, string[] keyColumns, string[] keyColumnTypes, object[] keyValues, string schema = null)
Parameters
table
stringThe table from which the data will be deleted.
keyColumns
string[]The names of the key columns used to select the row to delete.
keyColumnTypes
string[]The store types for the columns that will be used to identify the rows that should be deleted.
keyValues
object[]The key values of the row to delete, one value for each column in 'keyColumns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DeleteDataOperation>
A builder to allow annotations to be added to the operation.
DropCheckConstraint(string, string, string)
Builds an DropCheckConstraintOperation to drop an existing check constraint.
public virtual OperationBuilder<DropCheckConstraintOperation> DropCheckConstraint(string name, string table, string schema = null)
Parameters
name
stringThe name of the check constraint to drop.
table
stringThe name of the table for the check constraint to drop.
schema
stringThe schema that contains the check constraint, or null to use the default schema.
Returns
- OperationBuilder<DropCheckConstraintOperation>
A builder to allow annotations to be added to the operation.
DropColumn(string, string, string)
Builds an DropColumnOperation to drop an existing column.
public virtual OperationBuilder<DropColumnOperation> DropColumn(string name, string table, string schema = null)
Parameters
name
stringThe name of the column to drop.
table
stringThe table that contains the column.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DropColumnOperation>
A builder to allow annotations to be added to the operation.
DropForeignKey(string, string, string)
Builds an DropForeignKeyOperation to drop an existing foreign key constraint.
public virtual OperationBuilder<DropForeignKeyOperation> DropForeignKey(string name, string table, string schema = null)
Parameters
name
stringThe name of the foreign key constraint to drop.
table
stringThe table that contains the foreign key.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DropForeignKeyOperation>
A builder to allow annotations to be added to the operation.
DropIndex(string, string, string)
Builds an DropIndexOperation to drop an existing index.
public virtual OperationBuilder<DropIndexOperation> DropIndex(string name, string table = null, string schema = null)
Parameters
name
stringThe name of the index to drop.
table
stringThe table that contains the index.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DropIndexOperation>
A builder to allow annotations to be added to the operation.
DropPrimaryKey(string, string, string)
Builds an DropPrimaryKeyOperation to drop an existing primary key.
public virtual OperationBuilder<DropPrimaryKeyOperation> DropPrimaryKey(string name, string table, string schema = null)
Parameters
name
stringThe name of the primary key constraint to drop.
table
stringThe table that contains the key.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DropPrimaryKeyOperation>
A builder to allow annotations to be added to the operation.
DropSchema(string)
Builds an DropSchemaOperation to drop an existing schema.
public virtual OperationBuilder<DropSchemaOperation> DropSchema(string name)
Parameters
name
stringThe name of the schema to drop.
Returns
- OperationBuilder<DropSchemaOperation>
A builder to allow annotations to be added to the operation.
DropSequence(string, string)
Builds an DropSequenceOperation to drop an existing sequence.
public virtual OperationBuilder<DropSequenceOperation> DropSequence(string name, string schema = null)
Parameters
name
stringThe name of the sequence to drop.
schema
stringThe schema that contains the sequence, or null to use the default schema.
Returns
- OperationBuilder<DropSequenceOperation>
A builder to allow annotations to be added to the operation.
DropTable(string, string)
Builds an DropTableOperation to drop an existing table.
public virtual OperationBuilder<DropTableOperation> DropTable(string name, string schema = null)
Parameters
name
stringThe name of the table to drop.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DropTableOperation>
A builder to allow annotations to be added to the operation.
DropUniqueConstraint(string, string, string)
Builds an DropUniqueConstraintOperation to drop an existing unique constraint.
public virtual OperationBuilder<DropUniqueConstraintOperation> DropUniqueConstraint(string name, string table, string schema = null)
Parameters
name
stringThe name of the constraint to drop.
table
stringThe table that contains the constraint.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<DropUniqueConstraintOperation>
A builder to allow annotations to be added to the operation.
EnsureSchema(string)
Builds an EnsureSchemaOperation to ensure that a schema exists.
public virtual OperationBuilder<EnsureSchemaOperation> EnsureSchema(string name)
Parameters
name
stringThe name of the schema.
Returns
- OperationBuilder<EnsureSchemaOperation>
A builder to allow annotations to be added to the operation.
InsertData(string, string, object, string)
Builds an InsertDataOperation to insert a single seed data value for a single column.
public virtual OperationBuilder<InsertDataOperation> InsertData(string table, string column, object value, string schema = null)
Parameters
table
stringThe table into which the data will be inserted.
column
stringThe name of the column into which the data will be inserted.
value
objectThe value to insert.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<InsertDataOperation>
A builder to allow annotations to be added to the operation.
InsertData(string, string, object[], string)
Builds an InsertDataOperation to insert multiple rows of seed data values for a single column.
public virtual OperationBuilder<InsertDataOperation> InsertData(string table, string column, object[] values, string schema = null)
Parameters
table
stringThe table into which the data will be inserted.
column
stringThe name of the column into which the data will be inserted.
values
object[]The values to insert, one value for each row.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<InsertDataOperation>
A builder to allow annotations to be added to the operation.
InsertData(string, string, string, object, string)
Builds an InsertDataOperation to insert a single seed data value for a single column.
public virtual OperationBuilder<InsertDataOperation> InsertData(string table, string column, string columnType, object value, string schema = null)
Parameters
table
stringThe table into which the data will be inserted.
column
stringThe name of the column into which the data will be inserted.
columnType
stringThe store type for the column into which data will be inserted.
value
objectThe value to insert.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<InsertDataOperation>
A builder to allow annotations to be added to the operation.
InsertData(string, string, string, object[], string)
Builds an InsertDataOperation to insert multiple rows of seed data values for a single column.
public virtual OperationBuilder<InsertDataOperation> InsertData(string table, string column, string columnType, object[] values, string schema = null)
Parameters
table
stringThe table into which the data will be inserted.
column
stringThe name of the column into which the data will be inserted.
columnType
stringThe store type for the column into which data will be inserted.
values
object[]The values to insert, one value for each row.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<InsertDataOperation>
A builder to allow annotations to be added to the operation.
InsertData(string, string[], object[,], string)
Builds an InsertDataOperation to insert multiple rows of seed data values for multiple columns.
public virtual OperationBuilder<InsertDataOperation> InsertData(string table, string[] columns, object[,] values, string schema = null)
Parameters
table
stringThe table into which the data will be inserted.
columns
string[]The names of the columns into which the data will be inserted.
values
object[,]The values to insert where each element of the outer array represents a row, and each inner array contains values for each of the columns in 'columns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<InsertDataOperation>
A builder to allow annotations to be added to the operation.
InsertData(string, string[], object[], string)
Builds an InsertDataOperation to insert a single row of seed data values.
public virtual OperationBuilder<InsertDataOperation> InsertData(string table, string[] columns, object[] values, string schema = null)
Parameters
table
stringThe table into which the data will be inserted.
columns
string[]The names of the columns into which the data will be inserted.
values
object[]The values to insert, one value for each column in 'columns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<InsertDataOperation>
A builder to allow annotations to be added to the operation.
InsertData(string, string[], string[], object[,], string)
Builds an InsertDataOperation to insert multiple rows of seed data values for multiple columns.
public virtual OperationBuilder<InsertDataOperation> InsertData(string table, string[] columns, string[] columnTypes, object[,] values, string schema = null)
Parameters
table
stringThe table into which the data will be inserted.
columns
string[]The names of the columns into which the data will be inserted.
columnTypes
string[]A list of store types for the columns into which data will be inserted.
values
object[,]The values to insert where each element of the outer array represents a row, and each inner array contains values for each of the columns in 'columns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<InsertDataOperation>
A builder to allow annotations to be added to the operation.
InsertData(string, string[], string[], object[], string)
Builds an InsertDataOperation to insert a single row of seed data values.
public virtual OperationBuilder<InsertDataOperation> InsertData(string table, string[] columns, string[] columnTypes, object[] values, string schema = null)
Parameters
table
stringThe table into which the data will be inserted.
columns
string[]The names of the columns into which the data will be inserted.
columnTypes
string[]A list of store types for the columns into which data will be inserted.
values
object[]The values to insert, one value for each column in 'columns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<InsertDataOperation>
A builder to allow annotations to be added to the operation.
RenameColumn(string, string, string, string)
Builds an RenameColumnOperation to rename an existing column.
public virtual OperationBuilder<RenameColumnOperation> RenameColumn(string name, string table, string newName, string schema = null)
Parameters
name
stringThe name of the column to be renamed.
table
stringThe table that contains the column.
newName
stringThe new name for the column.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<RenameColumnOperation>
A builder to allow annotations to be added to the operation.
RenameIndex(string, string, string, string)
Builds an RenameIndexOperation to rename an existing index.
public virtual OperationBuilder<RenameIndexOperation> RenameIndex(string name, string newName, string table = null, string schema = null)
Parameters
name
stringThe name of the index to be renamed.
newName
stringThe new name for the column.
table
stringThe table that contains the index.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<RenameIndexOperation>
A builder to allow annotations to be added to the operation.
RenameSequence(string, string, string, string)
Builds an RenameSequenceOperation to rename an existing sequence.
public virtual OperationBuilder<RenameSequenceOperation> RenameSequence(string name, string schema = null, string newName = null, string newSchema = null)
Parameters
name
stringThe name of the sequence to be renamed.
schema
stringThe schema that contains the sequence, or null to use the default schema.
newName
stringThe new sequence name or null if only the schema has changed.
newSchema
stringThe new schema name or null if only the name has changed.
Returns
- OperationBuilder<RenameSequenceOperation>
A builder to allow annotations to be added to the operation.
RenameTable(string, string, string, string)
Builds an RenameTableOperation to rename an existing table.
public virtual OperationBuilder<RenameTableOperation> RenameTable(string name, string schema = null, string newName = null, string newSchema = null)
Parameters
name
stringThe name of the table to be renamed.
schema
stringThe schema that contains the table, or null to use the default schema.
newName
stringThe new table name or null if only the schema has changed.
newSchema
stringThe new schema name, or null to use the default schema.
Returns
- OperationBuilder<RenameTableOperation>
A builder to allow annotations to be added to the operation.
RestartSequence(string, long, string)
Builds an RestartSequenceOperation to re-start an existing sequence.
public virtual OperationBuilder<RestartSequenceOperation> RestartSequence(string name, long startValue = 1, string schema = null)
Parameters
name
stringThe name of the sequence.
startValue
longThe value at which the sequence will start, defaulting to 1.
schema
stringThe schema that contains the sequence, or null to use the default schema.
Returns
- OperationBuilder<RestartSequenceOperation>
A builder to allow annotations to be added to the operation.
Sql(string, bool)
Builds an SqlOperation to execute raw SQL.
public virtual OperationBuilder<SqlOperation> Sql(string sql, bool suppressTransaction = false)
Parameters
sql
stringThe SQL string to be executed to perform the operation.
suppressTransaction
boolIndicates whether or not transactions will be suppressed while executing the SQL.
Returns
- OperationBuilder<SqlOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string, object, string, object, string)
Builds an UpdateDataOperation to update a single row of seed data.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string keyColumn, object keyValue, string column, object value, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumn
stringThe name of the key column used to select the row to update.
keyValue
objectThe key value of the row to update.
column
stringThe column to update.
value
objectThe new value for the column in the selected row.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string, object, string[], object[], string)
Builds an UpdateDataOperation to update a single row of seed data.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string keyColumn, object keyValue, string[] columns, object[] values, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumn
stringThe name of the key column used to select the row to update.
keyValue
objectThe key value of the row to update.
columns
string[]The columns to update.
values
object[]The new values, one for each column in 'columns', for the selected row.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string, object[], string, object[], string)
Builds an UpdateDataOperation to update multiple rows of seed data.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string keyColumn, object[] keyValues, string column, object[] values, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumn
stringThe name of the key column used to select the row to update.
keyValues
object[]The key values of the rows to update, one value per row.
column
stringThe column to update.
values
object[]The new values for the column, one for each row specified in 'keyValues'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string, object[], string[], object[,], string)
Builds an UpdateDataOperation to update multiple rows of seed data.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string keyColumn, object[] keyValues, string[] columns, object[,] values, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumn
stringThe name of the key column used to select the row to update.
keyValues
object[]The key values of the rows to update, one value per row.
columns
string[]The columns to update.
values
object[,]The values for each update, where each element of the outer array represents a row specified in 'keyValues', and each inner array contains values for each of the columns in 'columns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string[], object[,], string, object[], string)
Builds an UpdateDataOperation to update multiple rows of seed data for a table with a composite (multi-column) key.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string[] keyColumns, object[,] keyValues, string column, object[] values, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumns
string[]The names of the key columns used to select the rows to update.
keyValues
object[,]The key values of the rows to update, where each element of the outer array represents a row, and each inner array contains values for each of the key columns in 'keyColumns'.
column
stringThe column to update.
values
object[]The new values for the column, one for each row specified in 'keyValues'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string[], object[,], string[], object[,], string)
Builds an UpdateDataOperation to update multiple rows of seed data for a table with a composite (multi-column) key.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string[] keyColumns, object[,] keyValues, string[] columns, object[,] values, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumns
string[]The names of the key columns used to select the rows to update.
keyValues
object[,]The key values of the rows to update, where each element of the outer array represents a row, and each inner array contains values for each of the key columns in 'keyColumns'.
columns
string[]The columns to update.
values
object[,]The values for each update, where each element of the outer array represents a row specified in 'keyValues', and each inner array contains values for each of the columns in 'columns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string[], object[], string, object, string)
Builds an UpdateDataOperation to update a single row of seed data for a table with a composite (multi-column) key.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string[] keyColumns, object[] keyValues, string column, object value, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumns
string[]The names of the key columns used to select the row to update.
keyValues
object[]The key values of the row to update, one value for each column in 'keyColumns'.
column
stringThe column to update.
value
objectThe new value for the column in the selected row.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string[], object[], string[], object[], string)
Builds an UpdateDataOperation to update a single row of seed data for a table with a composite (multi-column) key.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string[] keyColumns, object[] keyValues, string[] columns, object[] values, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumns
string[]The names of the key columns used to select the row to update.
keyValues
object[]The key values of the row to update, one value for each column in 'keyColumns'.
columns
string[]The columns to update.
values
object[]The new values, one for each column in 'columns', for the selected row.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string[], string[], object[,], string[], string[], object[,], string)
Builds an UpdateDataOperation to update multiple rows of seed data for a table with a composite (multi-column) key.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string[] keyColumns, string[] keyColumnTypes, object[,] keyValues, string[] columns, string[] columnTypes, object[,] values, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumns
string[]The names of the key columns used to select the rows to update.
keyColumnTypes
string[]A list of store types for the columns that will be used to identify the rows that should be updated.
keyValues
object[,]The key values of the rows to update, where each element of the outer array represents a row, and each inner array contains values for each of the key columns in 'keyColumns'.
columns
string[]The columns to update.
columnTypes
string[]A list of store types for the columns in which data will be updated.
values
object[,]The values for each update, where each element of the outer array represents a row specified in 'keyValues', and each inner array contains values for each of the columns in 'columns'.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.
UpdateData(string, string[], string[], object[], string[], string[], object[], string)
Builds an UpdateDataOperation to update a single row of seed data for a table with a composite (multi-column) key.
public virtual OperationBuilder<UpdateDataOperation> UpdateData(string table, string[] keyColumns, string[] keyColumnTypes, object[] keyValues, string[] columns, string[] columnTypes, object[] values, string schema = null)
Parameters
table
stringThe table containing the data to be updated.
keyColumns
string[]The names of the key columns used to select the row to update.
keyColumnTypes
string[]A list of store types for the columns that will be used to identify the rows that should be updated.
keyValues
object[]The key values of the row to update, one value for each column in 'keyColumns'.
columns
string[]The columns to update.
columnTypes
string[]A list of store types for the columns in which data will be updated.
values
object[]The new values, one for each column in 'columns', for the selected row.
schema
stringThe schema that contains the table, or null to use the default schema.
Returns
- OperationBuilder<UpdateDataOperation>
A builder to allow annotations to be added to the operation.