123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
- namespace MTWorkHR.Identity.Migrations
- {
- /// <inheritdoc />
- public partial class altrIdentity : Migration
- {
- /// <inheritdoc />
- 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<string>(
- name: "CreateUser",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.AddColumn<string>(
- name: "DeleteUserId",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.AddColumn<bool>(
- name: "IsDeleted",
- table: "AspNetUsers",
- type: "bit",
- nullable: false,
- defaultValue: false);
- migrationBuilder.AddColumn<bool>(
- name: "IsStopped",
- table: "AspNetUsers",
- type: "bit",
- nullable: false,
- defaultValue: false);
- migrationBuilder.AddColumn<string>(
- name: "ManagerId",
- table: "AspNetUsers",
- type: "nvarchar(450)",
- nullable: true);
- migrationBuilder.AddColumn<string>(
- name: "UpdateUser",
- table: "AspNetUsers",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.AddColumn<int>(
- name: "UserType",
- table: "AspNetUsers",
- type: "int",
- nullable: false,
- defaultValue: 0);
- migrationBuilder.AddColumn<DateTime>(
- name: "CreateDate",
- table: "AspNetRoles",
- type: "datetime2",
- nullable: false,
- defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
- migrationBuilder.AddColumn<string>(
- name: "CreateUser",
- table: "AspNetRoles",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.AddColumn<string>(
- name: "DeleteUserId",
- table: "AspNetRoles",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.AddColumn<bool>(
- name: "IsAdmin",
- table: "AspNetRoles",
- type: "bit",
- nullable: true);
- migrationBuilder.AddColumn<bool>(
- name: "IsDeleted",
- table: "AspNetRoles",
- type: "bit",
- nullable: false,
- defaultValue: false);
- migrationBuilder.AddColumn<DateTime>(
- name: "UpdateDate",
- table: "AspNetRoles",
- type: "datetime2",
- nullable: true);
- migrationBuilder.AddColumn<string>(
- name: "UpdateUser",
- table: "AspNetRoles",
- type: "nvarchar(max)",
- nullable: true);
- migrationBuilder.CreateTable(
- name: "ApplicationRoleApplicationUser",
- columns: table => new
- {
- UserRolesId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- UsersId = table.Column<string>(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<string>(type: "nvarchar(450)", nullable: false),
- Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
- NormalizedName = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_IdentityRole", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "Permissions",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- Name = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
- CategoryName = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false),
- Desc = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: false),
- Show = table.Column<bool>(type: "bit", nullable: false)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Permissions", x => x.Id);
- });
- migrationBuilder.CreateTable(
- name: "RolePermissions",
- columns: table => new
- {
- Id = table.Column<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
- PermissionId = table.Column<long>(type: "bigint", nullable: false),
- PermissionName = table.Column<string>(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");
- }
- /// <inheritdoc />
- 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" });
- }
- }
- }
|