using System; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional namespace Marco.Pms.DataAccess.Migrations { /// public partial class addFeatures : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_FeaturePermission_Features_FeatureId", table: "FeaturePermission"); migrationBuilder.DropForeignKey( name: "FK_Features_Tenants_TenantId", table: "Features"); migrationBuilder.DropPrimaryKey( name: "PK_FeaturePermission", table: "FeaturePermission"); migrationBuilder.DropColumn( name: "AllowCreate", table: "FeaturePermission"); migrationBuilder.DropColumn( name: "AllowDelete", table: "FeaturePermission"); migrationBuilder.DropColumn( name: "AllowModify", table: "FeaturePermission"); migrationBuilder.DropColumn( name: "AllowView", table: "FeaturePermission"); migrationBuilder.DropColumn( name: "TenantId", table: "FeaturePermission"); migrationBuilder.RenameTable( name: "FeaturePermission", newName: "FeaturePermissions"); migrationBuilder.RenameColumn( name: "TenantId", table: "Features", newName: "ModuleId"); migrationBuilder.RenameIndex( name: "IX_Features_TenantId", table: "Features", newName: "IX_Features_ModuleId"); migrationBuilder.RenameIndex( name: "IX_FeaturePermission_FeatureId", table: "FeaturePermissions", newName: "IX_FeaturePermissions_FeatureId"); migrationBuilder.AddColumn( name: "IsActive", table: "Features", type: "tinyint(1)", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "Description", table: "FeaturePermissions", type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "Name", table: "FeaturePermissions", type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddPrimaryKey( name: "PK_FeaturePermissions", table: "FeaturePermissions", column: "Id"); migrationBuilder.CreateTable( name: "Modules", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Name = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Description = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Key = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_Modules", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.InsertData( table: "Modules", columns: new[] { "Id", "Description", "Key", "Name" }, values: new object[,] { { 1, "Project Module", "9a7ed07c-f7dd-4831-bf64-d5278fa9e38c", "Project" }, { 2, "Employee Module", "a9fb08bf-7dae-4282-9b02-f63d94d7a9dc", "Employee" }, { 3, "Masters Module", "e6423995-d7bf-452e-8bcc-780a655b015c", "Masters" } }); migrationBuilder.InsertData( table: "Features", columns: new[] { "Id", "Description", "EmployeeRoleId", "IsActive", "ModuleId", "Name" }, values: new object[,] { { new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Assign and Update Tasks Progress", null, true, 1, "Assign and Update Tasks Progress" }, { new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), "Attendance", null, true, 2, "Attendance" }, { new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), "Manage Project", null, true, 1, "Manage Project" }, { new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), "Tenant Masters", null, true, 3, "Tenant Masters" }, { new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), "Manage Employee", null, true, 2, "Manage Employee" }, { new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), "Manage Infra", null, true, 1, "Manage Infra" }, { new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), "Manage Tasks", null, true, 1, "Manage Tasks" }, { new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), "Global Masters", null, true, 3, "Global Masters" } }); migrationBuilder.InsertData( table: "FeaturePermissions", columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" }, values: new object[,] { { new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5"), "", new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), true, "Manage Task" }, { new Guid("172fc9b6-755b-4f62-ab26-55c34a330614"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Project" }, { new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6"), "", new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), true, "Regularize Attendance" }, { new Guid("588a8824-f924-4955-82d8-fc51956cf323"), "", new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), true, "Manage Masters" }, { new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), "", new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), true, "View Masters" }, { new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), "", new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), true, "Manage Masters" }, { new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "View Project" }, { new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e"), "", new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), true, "Perform Attendance " }, { new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c"), "", new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), true, "View Task" }, { new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Manage Employee" }, { new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "View Employee" }, { new Guid("b94802ce-0689-4643-9e1d-11c86950c35b"), "", new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), true, "Manage Team" }, { new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8"), "", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "View Project Infra" }, { new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), "", new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), true, "View Masters" }, { new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Assign Task and Report Progress" }, { new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Approve Task" }, { new Guid("f2aee20a-b754-4537-8166-f9507b44585b"), "", new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), true, "Manage Project Infra" }, { new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), "", new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), true, "Assign To Project" } }); migrationBuilder.AddForeignKey( name: "FK_FeaturePermissions_Features_FeatureId", table: "FeaturePermissions", column: "FeatureId", principalTable: "Features", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Features_Modules_ModuleId", table: "Features", column: "ModuleId", principalTable: "Modules", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_FeaturePermissions_Features_FeatureId", table: "FeaturePermissions"); migrationBuilder.DropForeignKey( name: "FK_Features_Modules_ModuleId", table: "Features"); migrationBuilder.DropTable( name: "Modules"); migrationBuilder.DropPrimaryKey( name: "PK_FeaturePermissions", table: "FeaturePermissions"); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("08752f33-3b29-4816-b76b-ea8a968ed3c5")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("172fc9b6-755b-4f62-ab26-55c34a330614")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("57802c4a-00aa-4a1f-a048-fd2f70dd44b6")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("588a8824-f924-4955-82d8-fc51956cf323")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("6ea44136-987e-44ba-9e5d-1cf8f5837ebc")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("915e6bff-65f6-4e3f-aea8-3fd217d3ea9e")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("9fcc5f87-25e3-4846-90ac-67a71ab92e3c")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("a97d366a-c2bb-448d-be93-402bd2324566")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("b94802ce-0689-4643-9e1d-11c86950c35b")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("c7b68e33-72f0-474f-bd96-77636427ecc8")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("cb8ec407-46d4-4467-930c-69127cda6dec")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("d135a4b0-4f9a-4903-ab9c-4843839ebdee")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("ed99ecd4-1bed-42e1-b7b3-d64c04493823")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("f2aee20a-b754-4537-8166-f9507b44585b")); migrationBuilder.DeleteData( table: "FeaturePermissions", keyColumn: "Id", keyValue: new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3")); migrationBuilder.DeleteData( table: "Features", keyColumn: "Id", keyValue: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606")); migrationBuilder.DeleteData( table: "Features", keyColumn: "Id", keyValue: new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94")); migrationBuilder.DeleteData( table: "Features", keyColumn: "Id", keyValue: new Guid("53176ebf-c75d-42e5-839f-4508ffac3def")); migrationBuilder.DeleteData( table: "Features", keyColumn: "Id", keyValue: new Guid("660131a4-788c-4739-a082-cbbf7879cbf2")); migrationBuilder.DeleteData( table: "Features", keyColumn: "Id", keyValue: new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100")); migrationBuilder.DeleteData( table: "Features", keyColumn: "Id", keyValue: new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c")); migrationBuilder.DeleteData( table: "Features", keyColumn: "Id", keyValue: new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f")); migrationBuilder.DeleteData( table: "Features", keyColumn: "Id", keyValue: new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be")); migrationBuilder.DropColumn( name: "IsActive", table: "Features"); migrationBuilder.DropColumn( name: "Description", table: "FeaturePermissions"); migrationBuilder.DropColumn( name: "Name", table: "FeaturePermissions"); migrationBuilder.RenameTable( name: "FeaturePermissions", newName: "FeaturePermission"); migrationBuilder.RenameColumn( name: "ModuleId", table: "Features", newName: "TenantId"); migrationBuilder.RenameIndex( name: "IX_Features_ModuleId", table: "Features", newName: "IX_Features_TenantId"); migrationBuilder.RenameIndex( name: "IX_FeaturePermissions_FeatureId", table: "FeaturePermission", newName: "IX_FeaturePermission_FeatureId"); migrationBuilder.AddColumn( name: "AllowCreate", table: "FeaturePermission", type: "tinyint(1)", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "AllowDelete", table: "FeaturePermission", type: "tinyint(1)", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "AllowModify", table: "FeaturePermission", type: "tinyint(1)", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "AllowView", table: "FeaturePermission", type: "tinyint(1)", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "TenantId", table: "FeaturePermission", type: "int", nullable: false, defaultValue: 0); migrationBuilder.AddPrimaryKey( name: "PK_FeaturePermission", table: "FeaturePermission", column: "Id"); migrationBuilder.AddForeignKey( name: "FK_FeaturePermission_Features_FeatureId", table: "FeaturePermission", column: "FeatureId", principalTable: "Features", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Features_Tenants_TenantId", table: "Features", column: "TenantId", principalTable: "Tenants", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }