Share via


MigrationBuilder.AddCheckConstraint(String, String, String, String) Method

Definition

Builds an AddCheckConstraintOperation to add a new check constraint to a table.

public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddCheckConstraintOperation> AddCheckConstraint (string name, string table, string sql, string schema = default);
public virtual Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddCheckConstraintOperation> AddCheckConstraint (string name, string table, string sql, string? schema = default);
abstract member AddCheckConstraint : string * string * string * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddCheckConstraintOperation>
override this.AddCheckConstraint : string * string * string * string -> Microsoft.EntityFrameworkCore.Migrations.Operations.Builders.OperationBuilder<Microsoft.EntityFrameworkCore.Migrations.Operations.AddCheckConstraintOperation>
Public Overridable Function AddCheckConstraint (name As String, table As String, sql As String, Optional schema As String = Nothing) As OperationBuilder(Of AddCheckConstraintOperation)

Parameters

name
String

The check constraint name.

table
String

The name of the table for the check constraint.

sql
String

The constraint sql for the check constraint.

schema
String

The schema that contains the check constraint, or null to use the default schema.

Returns

A builder to allow annotations to be added to the operation.

Remarks

See Database migrations for more information and examples.

Applies to