using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
namespace MTWorkHR.Identity.Migrations
{
///
public partial class altrIdentity : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B");
migrationBuilder.DeleteData(
table: "AspNetRoles",
keyColumn: "Id",
keyValue: "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A");
migrationBuilder.AddColumn(
name: "CreateUser",
table: "AspNetUsers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn(
name: "DeleteUserId",
table: "AspNetUsers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn(
name: "IsDeleted",
table: "AspNetUsers",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn(
name: "IsStopped",
table: "AspNetUsers",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn(
name: "ManagerId",
table: "AspNetUsers",
type: "nvarchar(450)",
nullable: true);
migrationBuilder.AddColumn(
name: "UpdateUser",
table: "AspNetUsers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn(
name: "UserType",
table: "AspNetUsers",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn(
name: "CreateDate",
table: "AspNetRoles",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn(
name: "CreateUser",
table: "AspNetRoles",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn(
name: "DeleteUserId",
table: "AspNetRoles",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn(
name: "IsAdmin",
table: "AspNetRoles",
type: "bit",
nullable: true);
migrationBuilder.AddColumn(
name: "IsDeleted",
table: "AspNetRoles",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn(
name: "UpdateDate",
table: "AspNetRoles",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn(
name: "UpdateUser",
table: "AspNetRoles",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.CreateTable(
name: "ApplicationRoleApplicationUser",
columns: table => new
{
UserRolesId = table.Column(type: "nvarchar(450)", nullable: false),
UsersId = table.Column(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ApplicationRoleApplicationUser", x => new { x.UserRolesId, x.UsersId });
table.ForeignKey(
name: "FK_ApplicationRoleApplicationUser_AspNetRoles_UserRolesId",
column: x => x.UserRolesId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ApplicationRoleApplicationUser_AspNetUsers_UsersId",
column: x => x.UsersId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "IdentityRole",
columns: table => new
{
Id = table.Column(type: "nvarchar(450)", nullable: false),
Name = table.Column(type: "nvarchar(max)", nullable: true),
NormalizedName = table.Column(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_IdentityRole", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Permissions",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false),
CategoryName = table.Column(type: "nvarchar(150)", maxLength: 150, nullable: false),
Desc = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: false),
Show = table.Column(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Permissions", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RolePermissions",
columns: table => new
{
Id = table.Column(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleId = table.Column(type: "nvarchar(450)", nullable: false),
PermissionId = table.Column(type: "bigint", nullable: false),
PermissionName = table.Column(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_RolePermissions", x => x.Id);
table.ForeignKey(
name: "FK_RolePermissions_AspNetRoles_RoleId",
column: x => x.RoleId,
principalTable: "AspNetRoles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RolePermissions_Permissions_PermissionId",
column: x => x.PermissionId,
principalTable: "Permissions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
columns: new[] { "ConcurrencyStamp", "CreateUser", "DeleteUserId", "IsDeleted", "IsStopped", "ManagerId", "SecurityStamp", "UpdateUser", "UserType" },
values: new object[] { "b6b32734-b83c-4619-8de6-6e0e48cea904", null, null, false, false, null, "2ec2e41b-9f51-4779-9687-4cef7afd2c98", null, 1 });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
columns: new[] { "ConcurrencyStamp", "CreateUser", "DeleteUserId", "IsDeleted", "IsStopped", "ManagerId", "SecurityStamp", "UpdateUser", "UserType" },
values: new object[] { "f3684ce0-8dc7-4f91-b317-b6a7d8d55011", null, null, false, false, null, "50a3c8b2-93bf-41b3-bf7f-d2240d8b7386", null, 1 });
migrationBuilder.InsertData(
table: "IdentityRole",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", null, "Admin", "ADMIN" },
{ "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, "Employee", "EMPLOYEE" }
});
migrationBuilder.CreateIndex(
name: "IX_AspNetUsers_ManagerId",
table: "AspNetUsers",
column: "ManagerId");
migrationBuilder.CreateIndex(
name: "IX_ApplicationRoleApplicationUser_UsersId",
table: "ApplicationRoleApplicationUser",
column: "UsersId");
migrationBuilder.CreateIndex(
name: "IX_RolePermissions_PermissionId",
table: "RolePermissions",
column: "PermissionId");
migrationBuilder.CreateIndex(
name: "IX_RolePermissions_RoleId",
table: "RolePermissions",
column: "RoleId");
migrationBuilder.AddForeignKey(
name: "FK_AspNetUsers_AspNetUsers_ManagerId",
table: "AspNetUsers",
column: "ManagerId",
principalTable: "AspNetUsers",
principalColumn: "Id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_AspNetUsers_AspNetUsers_ManagerId",
table: "AspNetUsers");
migrationBuilder.DropTable(
name: "ApplicationRoleApplicationUser");
migrationBuilder.DropTable(
name: "IdentityRole");
migrationBuilder.DropTable(
name: "RolePermissions");
migrationBuilder.DropTable(
name: "Permissions");
migrationBuilder.DropIndex(
name: "IX_AspNetUsers_ManagerId",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "CreateUser",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "DeleteUserId",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "IsStopped",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "ManagerId",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "UpdateUser",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "UserType",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "CreateDate",
table: "AspNetRoles");
migrationBuilder.DropColumn(
name: "CreateUser",
table: "AspNetRoles");
migrationBuilder.DropColumn(
name: "DeleteUserId",
table: "AspNetRoles");
migrationBuilder.DropColumn(
name: "IsAdmin",
table: "AspNetRoles");
migrationBuilder.DropColumn(
name: "IsDeleted",
table: "AspNetRoles");
migrationBuilder.DropColumn(
name: "UpdateDate",
table: "AspNetRoles");
migrationBuilder.DropColumn(
name: "UpdateUser",
table: "AspNetRoles");
migrationBuilder.InsertData(
table: "AspNetRoles",
columns: new[] { "Id", "ConcurrencyStamp", "Name", "NormalizedName" },
values: new object[,]
{
{ "AD5B3B92-2311-48F8-9DEC-F9FAEF1F211B", null, "Admin", "ADMIN" },
{ "EM5B3B92-2311-48F8-9DEC-F9FAEF1F211A", null, "Employee", "EMPLOYEE" }
});
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "AD5B3B92-2311-48F8-9DEC-F9FAEF1F21UA",
columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
values: new object[] { "d1e41737-1312-47fe-b7e9-fa9917dd94ad", "7714198f-15f6-4524-a221-b0826892516b" });
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "LL5B3B92-2311-48F8-9DEC-F9FAEF1F21UB",
columns: new[] { "ConcurrencyStamp", "SecurityStamp" },
values: new object[] { "fe634cad-b63a-4cc1-8938-4499edd22d35", "bba3264c-1777-4ca7-837a-2f8ed1b16d01" });
}
}
}