67 lines
2.1 KiB
C#
67 lines
2.1 KiB
C#
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||
|
|
|||
|
#nullable disable
|
|||
|
|
|||
|
namespace CaseAccountingDataBaseImplement.Migrations
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
public partial class Sec : Migration
|
|||
|
{
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.DropForeignKey(
|
|||
|
name: "FK_Users_Roles_RoleId",
|
|||
|
table: "Users");
|
|||
|
|
|||
|
migrationBuilder.DropTable(
|
|||
|
name: "Roles");
|
|||
|
|
|||
|
migrationBuilder.DropIndex(
|
|||
|
name: "IX_Users_RoleId",
|
|||
|
table: "Users");
|
|||
|
|
|||
|
migrationBuilder.RenameColumn(
|
|||
|
name: "RoleId",
|
|||
|
table: "Users",
|
|||
|
newName: "Role");
|
|||
|
}
|
|||
|
|
|||
|
/// <inheritdoc />
|
|||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|||
|
{
|
|||
|
migrationBuilder.RenameColumn(
|
|||
|
name: "Role",
|
|||
|
table: "Users",
|
|||
|
newName: "RoleId");
|
|||
|
|
|||
|
migrationBuilder.CreateTable(
|
|||
|
name: "Roles",
|
|||
|
columns: table => new
|
|||
|
{
|
|||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
|||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|||
|
Name = table.Column<string>(type: "text", nullable: false)
|
|||
|
},
|
|||
|
constraints: table =>
|
|||
|
{
|
|||
|
table.PrimaryKey("PK_Roles", x => x.Id);
|
|||
|
});
|
|||
|
|
|||
|
migrationBuilder.CreateIndex(
|
|||
|
name: "IX_Users_RoleId",
|
|||
|
table: "Users",
|
|||
|
column: "RoleId");
|
|||
|
|
|||
|
migrationBuilder.AddForeignKey(
|
|||
|
name: "FK_Users_Roles_RoleId",
|
|||
|
table: "Users",
|
|||
|
column: "RoleId",
|
|||
|
principalTable: "Roles",
|
|||
|
principalColumn: "Id",
|
|||
|
onDelete: ReferentialAction.Cascade);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|