本文整理汇总了C#中MigrationBuilder.DropUniqueConstraint方法的典型用法代码示例。如果您正苦于以下问题:C# MigrationBuilder.DropUniqueConstraint方法的具体用法?C# MigrationBuilder.DropUniqueConstraint怎么用?C# MigrationBuilder.DropUniqueConstraint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MigrationBuilder
的用法示例。
在下文中一共展示了MigrationBuilder.DropUniqueConstraint方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Down
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropUniqueConstraint(
name: "AK_Users_UniqueId",
table: "Users");
migrationBuilder.DropUniqueConstraint(
name: "AK_SectionMemberships_ClassroomMembershipId_SectionId",
table: "SectionMemberships");
migrationBuilder.DropUniqueConstraint(
name: "AK_ClassroomMemberships_UserId_ClassroomId",
table: "ClassroomMemberships");
migrationBuilder.DropUniqueConstraint(
name: "AK_QuestionCategories_ClassroomId_Name",
table: "QuestionCategories");
migrationBuilder.DropUniqueConstraint(
name: "AK_Questions_QuestionCategoryId_Name",
table: "Questions");
migrationBuilder.DropUniqueConstraint(
name: "AK_Sections_ClassroomId_Name",
table: "Sections");
migrationBuilder.DropUniqueConstraint(
name: "AK_Classrooms_Name",
table: "Classrooms");
migrationBuilder.AlterColumn<string>(
name: "UniqueId",
table: "Users",
nullable: true);
}
示例2: Down
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_ReleaseBatchItem_ReleaseBatch_ReleaseBatchId", schema: "kraken", table: "ReleaseBatchItem");
migrationBuilder.DropUniqueConstraint(name: "AK_ReleaseBatch_Name", schema: "kraken", table: "ReleaseBatch");
migrationBuilder.AddForeignKey(
name: "FK_ReleaseBatchItem_ReleaseBatch_ReleaseBatchId",
schema: "kraken",
table: "ReleaseBatchItem",
column: "ReleaseBatchId",
principalSchema: "kraken",
principalTable: "ReleaseBatch",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
示例3: Up
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_ReleaseBatchItem_ReleaseBatch_ReleaseBatchId", schema: "kraken", table: "ReleaseBatchItem");
migrationBuilder.DropUniqueConstraint(name: "AK_ReleaseBatch_Name", schema: "kraken", table: "ReleaseBatch");
migrationBuilder.CreateIndex(
name: "IX_ReleaseBatch_Name",
schema: "kraken",
table: "ReleaseBatch",
column: "Name",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_ReleaseBatchItem_ReleaseBatch_ReleaseBatchId",
schema: "kraken",
table: "ReleaseBatchItem",
column: "ReleaseBatchId",
principalSchema: "kraken",
principalTable: "ReleaseBatch",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
示例4: Up
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_Gebruiker_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_Gebruiker_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_Gebruiker_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_BestellingMateriaalItem_Bestelling_BestellingId", table: "BestellingMateriaalItem");
migrationBuilder.DropForeignKey(name: "FK_BestellingMateriaalItem_MateriaalItem_MateriaalItemId", table: "BestellingMateriaalItem");
migrationBuilder.DropForeignKey(name: "FK_MateriaalDoelgroep_Doelgroep_DoelgroepId", table: "MateriaalDoelgroep");
migrationBuilder.DropForeignKey(name: "FK_MateriaalDoelgroep_Materiaal_MateriaalId", table: "MateriaalDoelgroep");
migrationBuilder.DropForeignKey(name: "FK_MateriaalItem_Materiaal_MateriaalId", table: "MateriaalItem");
migrationBuilder.DropForeignKey(name: "FK_MateriaalLeergebied_Leergebied_LeergebiedId", table: "MateriaalLeergebied");
migrationBuilder.DropForeignKey(name: "FK_MateriaalLeergebied_Materiaal_MateriaalId", table: "MateriaalLeergebied");
migrationBuilder.DropForeignKey(name: "FK_MateriaalVerlanglijst_Materiaal_MateriaalId", table: "MateriaalVerlanglijst");
migrationBuilder.DropForeignKey(name: "FK_MateriaalVerlanglijst_Verlanglijst_VerlanglijstId", table: "MateriaalVerlanglijst");
migrationBuilder.DropForeignKey(name: "FK_Uitleeninformatie_MateriaalItem_MateriaalItemId", table: "Uitleeninformatie");
migrationBuilder.DropForeignKey(name: "FK_Verlanglijst_Gebruiker_GebruikerForeignKey", table: "Verlanglijst");
migrationBuilder.DropUniqueConstraint(name: "AK_Gebruiker_GebruikerForeignKey", table: "AspNetUsers");
migrationBuilder.DropColumn(name: "GebruikerForeignKey", table: "Verlanglijst");
migrationBuilder.DropColumn(name: "GebruikerForeignKey", table: "AspNetUsers");
migrationBuilder.AddColumn<int>(
name: "GebruikerId",
table: "Verlanglijst",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "GebruikerId1",
table: "Verlanglijst",
nullable: true);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_Gebruiker_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_Gebruiker_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_Gebruiker_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BestellingMateriaalItem_Bestelling_BestellingId",
table: "BestellingMateriaalItem",
column: "BestellingId",
principalTable: "Bestelling",
principalColumn: "BestellingId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_BestellingMateriaalItem_MateriaalItem_MateriaalItemId",
table: "BestellingMateriaalItem",
column: "MateriaalItemId",
principalTable: "MateriaalItem",
principalColumn: "MateriaalItemId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_MateriaalDoelgroep_Doelgroep_DoelgroepId",
table: "MateriaalDoelgroep",
column: "DoelgroepId",
principalTable: "Doelgroep",
principalColumn: "DoelgroepId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_MateriaalDoelgroep_Materiaal_MateriaalId",
table: "MateriaalDoelgroep",
column: "MateriaalId",
principalTable: "Materiaal",
principalColumn: "MateriaalId",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_MateriaalItem_Materiaal_MateriaalId",
table: "MateriaalItem",
column: "MateriaalId",
principalTable: "Materiaal",
principalColumn: "MateriaalId",
onDelete: ReferentialAction.Cascade);
//.........这里部分代码省略.........
示例5: Up
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId", table: "AspNetRoleClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId", table: "AspNetUserClaims");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId", table: "AspNetUserLogins");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_IdentityRole_RoleId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_IdentityUserRole<string>_ApplicationUser_UserId", table: "AspNetUserRoles");
migrationBuilder.DropForeignKey(name: "FK_Contact_Item_Contact_contactId", table: "Contact_Item");
migrationBuilder.DropForeignKey(name: "FK_Ferias_Funcionario_funcionarioId", table: "Ferias");
migrationBuilder.DropForeignKey(name: "FK_Ferias_Itens_Funcionario_funcionarioId", table: "Ferias_Itens");
migrationBuilder.DropForeignKey(name: "FK_FuncFerias_Funcionario_funcionarioId", table: "FuncFerias");
migrationBuilder.DropForeignKey(name: "FK_FuncInfFerias_Funcionario_funcionarioId", table: "FuncInfFerias");
migrationBuilder.DropForeignKey(name: "FK_Funcionario_Departamento_departamentoId", table: "Funcionario");
migrationBuilder.DropForeignKey(name: "FK_Historio_Ferias_Item_Ferias_Itens_ferias_item_id", table: "Historio_Ferias_Item");
migrationBuilder.DropUniqueConstraint(name: "AK_Contact_contactId", table: "Contact");
migrationBuilder.DropColumn(name: "contactId", table: "Contact");
migrationBuilder.AlterColumn<int>(
name: "contactId",
table: "Contact_Item",
nullable: false);
migrationBuilder.AddForeignKey(
name: "FK_IdentityRoleClaim<string>_IdentityRole_RoleId",
table: "AspNetRoleClaims",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserClaim<string>_ApplicationUser_UserId",
table: "AspNetUserClaims",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserLogin<string>_ApplicationUser_UserId",
table: "AspNetUserLogins",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_IdentityRole_RoleId",
table: "AspNetUserRoles",
column: "RoleId",
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_IdentityUserRole<string>_ApplicationUser_UserId",
table: "AspNetUserRoles",
column: "UserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Contact_Item_Contact_contactId",
table: "Contact_Item",
column: "contactId",
principalTable: "Contact",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Ferias_Funcionario_funcionarioId",
table: "Ferias",
column: "funcionarioId",
principalTable: "Funcionario",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Ferias_Itens_Funcionario_funcionarioId",
table: "Ferias_Itens",
column: "funcionarioId",
principalTable: "Funcionario",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FuncFerias_Funcionario_funcionarioId",
table: "FuncFerias",
column: "funcionarioId",
principalTable: "Funcionario",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_FuncInfFerias_Funcionario_funcionarioId",
table: "FuncInfFerias",
column: "funcionarioId",
principalTable: "Funcionario",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Funcionario_Departamento_departamentoId",
table: "Funcionario",
column: "departamentoId",
principalTable: "Departamento",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_Historio_Ferias_Item_Ferias_Itens_ferias_item_id",
table: "Historio_Ferias_Item",
//.........这里部分代码省略.........
示例6: Up
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropUniqueConstraint(
name: "AK_Users_UniqueId",
table: "Users");
migrationBuilder.DropUniqueConstraint(
name: "AK_SectionMemberships_ClassroomMembershipId_SectionId",
table: "SectionMemberships");
migrationBuilder.DropUniqueConstraint(
name: "AK_ClassroomMemberships_UserId_ClassroomId",
table: "ClassroomMemberships");
migrationBuilder.DropUniqueConstraint(
name: "AK_QuestionCategories_ClassroomId_Name",
table: "QuestionCategories");
migrationBuilder.DropUniqueConstraint(
name: "AK_Questions_QuestionCategoryId_Name",
table: "Questions");
migrationBuilder.DropUniqueConstraint(
name: "AK_Sections_ClassroomId_Name",
table: "Sections");
migrationBuilder.DropUniqueConstraint(
name: "AK_Classrooms_Name",
table: "Classrooms");
migrationBuilder.DropColumn(
name: "RandomizeAnswers",
table: "Questions");
migrationBuilder.CreateTable(
name: "UserQuestionData",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
CachedQuestionData = table.Column<string>(nullable: true),
CachedQuestionDataTime = table.Column<DateTime>(nullable: true),
LastQuestionSubmission = table.Column<string>(nullable: true),
NumAttempts = table.Column<int>(nullable: false),
QuestionId = table.Column<int>(nullable: false),
Seed = table.Column<int>(nullable: true),
UserId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserQuestionData", x => x.Id);
});
migrationBuilder.CreateTable(
name: "UserQuestionSubmission",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.SerialColumn),
DateSubmitted = table.Column<DateTime>(nullable: false),
Score = table.Column<double>(nullable: false),
UserQuestionDataId = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_UserQuestionSubmission", x => x.Id);
table.ForeignKey(
name: "FK_UserQuestionSubmission_UserQuestionData_UserQuestionDataId",
column: x => x.UserQuestionDataId,
principalTable: "UserQuestionData",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.AddColumn<bool>(
name: "IsPrivate",
table: "QuestionCategories",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "AllowPartialCredit",
table: "Questions",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "IsPrivate",
table: "Questions",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<DateTime>(
name: "DateModified",
table: "Questions",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "FullGeneratorFileContents",
table: "Questions",
//.........这里部分代码省略.........