78 lines
2.3 KiB
C#
78 lines
2.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace BeReadyBackend.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddedIsFinishedInGroupAndDeletedStatus : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Groups_Status_StatusId",
|
|
table: "Groups");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Status");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Groups_StatusId",
|
|
table: "Groups");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "StatusId",
|
|
table: "Groups");
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsFinished",
|
|
table: "Groups",
|
|
type: "bit",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "IsFinished",
|
|
table: "Groups");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "StatusId",
|
|
table: "Groups",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Status",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Label = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Status", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Groups_StatusId",
|
|
table: "Groups",
|
|
column: "StatusId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Groups_Status_StatusId",
|
|
table: "Groups",
|
|
column: "StatusId",
|
|
principalTable: "Status",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|