Share via


MigrationBuilder.AddUniqueConstraint Method

Definition

Overloads

AddUniqueConstraint(String, String, String, String)

Builds an AddUniqueConstraintOperation to add a new unique constraint to a table.

AddUniqueConstraint(String, String, String[], String)

Builds an AddUniqueConstraintOperation to add a new composite (multi-column) unique constraint to a table.

AddUniqueConstraint(String, String, String, String)

Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs

Builds an AddUniqueConstraintOperation to add a new unique constraint to a table.

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

Parameters

name
String

The constraint name.

table
String

The table that will contain the constraint.

column
String

The column that is constrained.

schema
String

The schema that contains the table, 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

AddUniqueConstraint(String, String, String[], String)

Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs
Source:
MigrationBuilder.cs

Builds an AddUniqueConstraintOperation to add a new composite (multi-column) unique constraint to a table.

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

Parameters

name
String

The constraint name.

table
String

The table that will contain the constraint.

columns
String[]

The ordered list of columns that are constrained.

schema
String

The schema that contains the table, 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