Project/Project.Web/Migrations/20240813083456_Zwoelfte.cs

116 lines
3.4 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Project.Web.Migrations
{
/// <inheritdoc />
public partial class Zwoelfte : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_USER_ROLE_RoleId",
schema: "dbo",
table: "USER");
migrationBuilder.DropIndex(
name: "IX_USER_RoleId",
schema: "dbo",
table: "USER");
migrationBuilder.DropColumn(
name: "RoleId",
schema: "dbo",
table: "USER");
migrationBuilder.AlterColumn<int>(
name: "ROLE_ID",
schema: "dbo",
table: "USER",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AddColumn<int>(
name: "ROLE",
schema: "dbo",
table: "USER",
type: "int",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_USER_ROLE_ID",
schema: "dbo",
table: "USER",
column: "ROLE_ID");
migrationBuilder.AddForeignKey(
name: "FK_USER_ROLE_ROLE_ID",
schema: "dbo",
table: "USER",
column: "ROLE_ID",
principalSchema: "dbo",
principalTable: "ROLE",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_USER_ROLE_ROLE_ID",
schema: "dbo",
table: "USER");
migrationBuilder.DropIndex(
name: "IX_USER_ROLE_ID",
schema: "dbo",
table: "USER");
migrationBuilder.DropColumn(
name: "ROLE",
schema: "dbo",
table: "USER");
migrationBuilder.AlterColumn<int>(
name: "ROLE_ID",
schema: "dbo",
table: "USER",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AddColumn<int>(
name: "RoleId",
schema: "dbo",
table: "USER",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_USER_RoleId",
schema: "dbo",
table: "USER",
column: "RoleId");
migrationBuilder.AddForeignKey(
name: "FK_USER_ROLE_RoleId",
schema: "dbo",
table: "USER",
column: "RoleId",
principalSchema: "dbo",
principalTable: "ROLE",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
}
}
}