From 2267d1236abcdae324f5b1212b8eb691747c701f Mon Sep 17 00:00:00 2001 From: Suphonchai Phoonsawat Date: Fri, 3 May 2024 14:48:21 +0700 Subject: [PATCH] fix migration problem --- ...0240503074712_Init for Oracle.Designer.cs} | 19 ++- ...t.cs => 20240503074712_Init for Oracle.cs} | 132 +----------------- .../ApplicationDBContextModelSnapshot.cs | 15 +- .../Persistence/ApplicationDBContext.cs | 4 + 4 files changed, 31 insertions(+), 139 deletions(-) rename BMA.EHR.Infrastructure/Migrations/ApplicationDB/{20240503070505_Init Oracle Project.Designer.cs => 20240503074712_Init for Oracle.Designer.cs} (99%) rename BMA.EHR.Infrastructure/Migrations/ApplicationDB/{20240503070505_Init Oracle Project.cs => 20240503074712_Init for Oracle.cs} (96%) diff --git a/BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503070505_Init Oracle Project.Designer.cs b/BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503074712_Init for Oracle.Designer.cs similarity index 99% rename from BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503070505_Init Oracle Project.Designer.cs rename to BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503074712_Init for Oracle.Designer.cs index 198bf353..1946c4f9 100644 --- a/BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503070505_Init Oracle Project.Designer.cs +++ b/BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503074712_Init for Oracle.Designer.cs @@ -12,8 +12,8 @@ using Oracle.EntityFrameworkCore.Metadata; namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB { [DbContext(typeof(ApplicationDBContext))] - [Migration("20240503070505_Init Oracle Project")] - partial class InitOracleProject + [Migration("20240503074712_Init for Oracle")] + partial class InitforOracle { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -10096,7 +10096,10 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB b.HasIndex("PositionEmployeeLevelId"); - b.ToTable("OrganizationPositionEmployeeLevels"); + b.ToTable("OrganizationPositionEmployeeLevels", t => + { + t.ExcludeFromMigrations(); + }); }); modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b => @@ -10158,7 +10161,10 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB b.HasIndex("PositionEmployeePositionSideId"); - b.ToTable("OrganizationPositionEmployeePositionSides"); + b.ToTable("OrganizationPositionEmployeePositionSides", t => + { + t.ExcludeFromMigrations(); + }); }); modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b => @@ -10763,7 +10769,10 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB b.HasIndex("PositionMasterEntityId"); - b.ToTable("PositionMasterHistoryEntity"); + b.ToTable("PositionMasterHistoryEntity", t => + { + t.ExcludeFromMigrations(); + }); }); modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b => diff --git a/BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503070505_Init Oracle Project.cs b/BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503074712_Init for Oracle.cs similarity index 96% rename from BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503070505_Init Oracle Project.cs rename to BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503074712_Init for Oracle.cs index e0af0d53..20600f3c 100644 --- a/BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503070505_Init Oracle Project.cs +++ b/BMA.EHR.Infrastructure/Migrations/ApplicationDB/20240503074712_Init for Oracle.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB { /// - public partial class InitOracleProject : Migration + public partial class InitforOracle : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) @@ -248,64 +248,6 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB table.PrimaryKey("PK_Notifications", x => x.Id); }); - migrationBuilder.CreateTable( - name: "OrganizationPositionEmployeeLevels", - columns: table => new - { - Id = table.Column(type: "RAW(16)", nullable: false, comment: "PrimaryKey"), - CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), - CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"), - LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"), - LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"), - CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"), - LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"), - OrganizationEmployeeId = table.Column(type: "RAW(16)", nullable: true), - PositionEmployeeLevelId = table.Column(type: "RAW(16)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_OrganizationPositionEmployeeLevels", x => x.Id); - table.ForeignKey( - name: "FK_OrganizationPositionEmployeeLevels_OrganizationEmployees_OrganizationEmployeeId", - column: x => x.OrganizationEmployeeId, - principalTable: "OrganizationEmployees", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_OrganizationPositionEmployeeLevels_PositionEmployeeLevels_PositionEmployeeLevelId", - column: x => x.PositionEmployeeLevelId, - principalTable: "PositionEmployeeLevels", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "OrganizationPositionEmployeePositionSides", - columns: table => new - { - Id = table.Column(type: "RAW(16)", nullable: false, comment: "PrimaryKey"), - CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), - CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"), - LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"), - LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"), - CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"), - LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"), - OrganizationEmployeeId = table.Column(type: "RAW(16)", nullable: true), - PositionEmployeePositionSideId = table.Column(type: "RAW(16)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_OrganizationPositionEmployeePositionSides", x => x.Id); - table.ForeignKey( - name: "FK_OrganizationPositionEmployeePositionSides_OrganizationEmployees_OrganizationEmployeeId", - column: x => x.OrganizationEmployeeId, - principalTable: "OrganizationEmployees", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_OrganizationPositionEmployeePositionSides_PositionEmployeePositionSides_PositionEmployeePositionSideId", - column: x => x.PositionEmployeePositionSideId, - principalTable: "PositionEmployeePositionSides", - principalColumn: "Id"); - }); - migrationBuilder.CreateTable( name: "PlacementIsProperties", columns: table => new @@ -695,44 +637,6 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB table.PrimaryKey("PK_PlacementTypes", x => x.Id); }); - migrationBuilder.CreateTable( - name: "PositionMasterHistoryEntity", - columns: table => new - { - Id = table.Column(type: "RAW(16)", nullable: false, comment: "PrimaryKey"), - Position = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "Position"), - PositionPath = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionPath"), - PositionType = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionType"), - PositionExecutive = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionExecutive"), - PositionExecutiveSide = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionExecutiveSide"), - PositionPathSide = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionPathSide"), - PositionLine = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionLine"), - PositionStatus = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionStatus"), - PositionCondition = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionCondition"), - PositionLevel = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionLevel"), - PositionMasterUserNote = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "PositionMasterUserNote"), - IsDirector = table.Column(type: "NUMBER(1)", nullable: true, comment: "IsDirector"), - Qualification = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "คุณวุฒิ"), - CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), - CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"), - LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"), - LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"), - CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"), - LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"), - PositionMasterEntityId = table.Column(type: "RAW(16)", nullable: true), - PositionPathSideObject = table.Column(type: "NVARCHAR2(2000)", nullable: true), - PositionExecutiveSideObject = table.Column(type: "NVARCHAR2(2000)", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_PositionMasterHistoryEntity", x => x.Id); - table.ForeignKey( - name: "FK_PositionMasterHistoryEntity_PositionMasters_PositionMasterEntityId", - column: x => x.PositionMasterEntityId, - principalTable: "PositionMasters", - principalColumn: "Id"); - }); - migrationBuilder.CreateTable( name: "RetirementDeceaseds", columns: table => new @@ -2580,26 +2484,6 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB table: "InsigniaRequests", column: "PeriodId"); - migrationBuilder.CreateIndex( - name: "IX_OrganizationPositionEmployeeLevels_OrganizationEmployeeId", - table: "OrganizationPositionEmployeeLevels", - column: "OrganizationEmployeeId"); - - migrationBuilder.CreateIndex( - name: "IX_OrganizationPositionEmployeeLevels_PositionEmployeeLevelId", - table: "OrganizationPositionEmployeeLevels", - column: "PositionEmployeeLevelId"); - - migrationBuilder.CreateIndex( - name: "IX_OrganizationPositionEmployeePositionSides_OrganizationEmployeeId", - table: "OrganizationPositionEmployeePositionSides", - column: "OrganizationEmployeeId"); - - migrationBuilder.CreateIndex( - name: "IX_OrganizationPositionEmployeePositionSides_PositionEmployeePositionSideId", - table: "OrganizationPositionEmployeePositionSides", - column: "PositionEmployeePositionSideId"); - migrationBuilder.CreateIndex( name: "IX_PlacementAppointmentDocs_DocumentId", table: "PlacementAppointmentDocs", @@ -2910,11 +2794,6 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB table: "PlacementTransfers", column: "ProfileId"); - migrationBuilder.CreateIndex( - name: "IX_PositionMasterHistoryEntity_PositionMasterEntityId", - table: "PositionMasterHistoryEntity", - column: "PositionMasterEntityId"); - migrationBuilder.CreateIndex( name: "IX_RetirementDeceasedNotis_DocumentId", table: "RetirementDeceasedNotis", @@ -3047,12 +2926,6 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB migrationBuilder.DropTable( name: "Notifications"); - migrationBuilder.DropTable( - name: "OrganizationPositionEmployeeLevels"); - - migrationBuilder.DropTable( - name: "OrganizationPositionEmployeePositionSides"); - migrationBuilder.DropTable( name: "PlacementAppointmentDocs"); @@ -3083,9 +2956,6 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB migrationBuilder.DropTable( name: "PlacementTransferDocs"); - migrationBuilder.DropTable( - name: "PositionMasterHistoryEntity"); - migrationBuilder.DropTable( name: "RetirementDeceasedNotis"); diff --git a/BMA.EHR.Infrastructure/Migrations/ApplicationDB/ApplicationDBContextModelSnapshot.cs b/BMA.EHR.Infrastructure/Migrations/ApplicationDB/ApplicationDBContextModelSnapshot.cs index 3d98f4dc..297a6e05 100644 --- a/BMA.EHR.Infrastructure/Migrations/ApplicationDB/ApplicationDBContextModelSnapshot.cs +++ b/BMA.EHR.Infrastructure/Migrations/ApplicationDB/ApplicationDBContextModelSnapshot.cs @@ -10093,7 +10093,10 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB b.HasIndex("PositionEmployeeLevelId"); - b.ToTable("OrganizationPositionEmployeeLevels"); + b.ToTable("OrganizationPositionEmployeeLevels", t => + { + t.ExcludeFromMigrations(); + }); }); modelBuilder.Entity("BMA.EHR.Domain.Models.OrganizationEmployee.OrganizationPositionEmployeePositionSide", b => @@ -10155,7 +10158,10 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB b.HasIndex("PositionEmployeePositionSideId"); - b.ToTable("OrganizationPositionEmployeePositionSides"); + b.ToTable("OrganizationPositionEmployeePositionSides", t => + { + t.ExcludeFromMigrations(); + }); }); modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.AvailablePositionLevelEntity", b => @@ -10760,7 +10766,10 @@ namespace BMA.EHR.Infrastructure.Migrations.ApplicationDB b.HasIndex("PositionMasterEntityId"); - b.ToTable("PositionMasterHistoryEntity"); + b.ToTable("PositionMasterHistoryEntity", t => + { + t.ExcludeFromMigrations(); + }); }); modelBuilder.Entity("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", b => diff --git a/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs index 2ec7dfac..d078329e 100644 --- a/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs +++ b/BMA.EHR.Infrastructure/Persistence/ApplicationDBContext.cs @@ -414,6 +414,10 @@ namespace BMA.EHR.Infrastructure.Persistence modelBuilder.Entity().Metadata.SetIsTableExcludedFromMigrations(true); modelBuilder.Entity().Metadata.SetIsTableExcludedFromMigrations(true); modelBuilder.Entity().Metadata.SetIsTableExcludedFromMigrations(true); + modelBuilder.Entity().Metadata.SetIsTableExcludedFromMigrations(true); + + modelBuilder.Entity().Metadata.SetIsTableExcludedFromMigrations(true); + modelBuilder.Entity().Metadata.SetIsTableExcludedFromMigrations(true); modelBuilder.Entity().Metadata.SetIsTableExcludedFromMigrations(true); modelBuilder.Entity().Metadata.SetIsTableExcludedFromMigrations(true);