using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace MTWorkHR.Infrastructure.Migrations { /// public partial class altrOrderRequestAttach : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_BusinessTripExpenses_OrderAttachment_AccommodationAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropForeignKey( name: "FK_BusinessTripExpenses_OrderAttachment_OtherAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropForeignKey( name: "FK_BusinessTripExpenses_OrderAttachment_TicketAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropForeignKey( name: "FK_BusinessTripExpenses_OrderAttachment_TransportationAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropForeignKey( name: "FK_OverTimeDay_OrderAttachment_OverTimeAttachmentId", table: "OverTimeDay"); migrationBuilder.DropIndex( name: "IX_OverTimeDay_OverTimeAttachmentId", table: "OverTimeDay"); migrationBuilder.DropIndex( name: "IX_BusinessTripExpenses_AccommodationAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropIndex( name: "IX_BusinessTripExpenses_OtherAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropIndex( name: "IX_BusinessTripExpenses_TicketAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropIndex( name: "IX_BusinessTripExpenses_TransportationAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropColumn( name: "OverTimeAttachmentId", table: "OverTimeDay"); migrationBuilder.DropColumn( name: "AccommodationAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropColumn( name: "OtherAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropColumn( name: "TicketAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.DropColumn( name: "TransportationAttachmentId", table: "BusinessTripExpenses"); migrationBuilder.CreateTable( name: "BusinessTripAttachment", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CreateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), UpdateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), CreateDate = table.Column(type: "datetime2", nullable: false), UpdateDate = table.Column(type: "datetime2", nullable: true), BusinessTripExpensesId = table.Column(type: "bigint", nullable: false), FileName = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), OriginalName = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), FilePath = table.Column(type: "nvarchar(max)", nullable: true), ContentType = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_BusinessTripAttachment", x => x.Id); table.ForeignKey( name: "FK_BusinessTripAttachment_BusinessTripExpenses_BusinessTripExpensesId", column: x => x.BusinessTripExpensesId, principalTable: "BusinessTripExpenses", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "OverTimeDayAttachment", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CreateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), UpdateUser = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), CreateDate = table.Column(type: "datetime2", nullable: false), UpdateDate = table.Column(type: "datetime2", nullable: true), OverTimeDayId = table.Column(type: "bigint", nullable: false), FileName = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), OriginalName = table.Column(type: "nvarchar(250)", maxLength: 250, nullable: true), FilePath = table.Column(type: "nvarchar(max)", nullable: true), ContentType = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_OverTimeDayAttachment", x => x.Id); table.ForeignKey( name: "FK_OverTimeDayAttachment_OverTimeDay_OverTimeDayId", column: x => x.OverTimeDayId, principalTable: "OverTimeDay", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_BusinessTripAttachment_BusinessTripExpensesId", table: "BusinessTripAttachment", column: "BusinessTripExpensesId"); migrationBuilder.CreateIndex( name: "IX_OverTimeDayAttachment_OverTimeDayId", table: "OverTimeDayAttachment", column: "OverTimeDayId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "BusinessTripAttachment"); migrationBuilder.DropTable( name: "OverTimeDayAttachment"); migrationBuilder.AddColumn( name: "OverTimeAttachmentId", table: "OverTimeDay", type: "bigint", nullable: true); migrationBuilder.AddColumn( name: "AccommodationAttachmentId", table: "BusinessTripExpenses", type: "bigint", nullable: true); migrationBuilder.AddColumn( name: "OtherAttachmentId", table: "BusinessTripExpenses", type: "bigint", nullable: true); migrationBuilder.AddColumn( name: "TicketAttachmentId", table: "BusinessTripExpenses", type: "bigint", nullable: true); migrationBuilder.AddColumn( name: "TransportationAttachmentId", table: "BusinessTripExpenses", type: "bigint", nullable: true); migrationBuilder.CreateIndex( name: "IX_OverTimeDay_OverTimeAttachmentId", table: "OverTimeDay", column: "OverTimeAttachmentId"); migrationBuilder.CreateIndex( name: "IX_BusinessTripExpenses_AccommodationAttachmentId", table: "BusinessTripExpenses", column: "AccommodationAttachmentId"); migrationBuilder.CreateIndex( name: "IX_BusinessTripExpenses_OtherAttachmentId", table: "BusinessTripExpenses", column: "OtherAttachmentId"); migrationBuilder.CreateIndex( name: "IX_BusinessTripExpenses_TicketAttachmentId", table: "BusinessTripExpenses", column: "TicketAttachmentId"); migrationBuilder.CreateIndex( name: "IX_BusinessTripExpenses_TransportationAttachmentId", table: "BusinessTripExpenses", column: "TransportationAttachmentId"); migrationBuilder.AddForeignKey( name: "FK_BusinessTripExpenses_OrderAttachment_AccommodationAttachmentId", table: "BusinessTripExpenses", column: "AccommodationAttachmentId", principalTable: "OrderAttachment", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_BusinessTripExpenses_OrderAttachment_OtherAttachmentId", table: "BusinessTripExpenses", column: "OtherAttachmentId", principalTable: "OrderAttachment", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_BusinessTripExpenses_OrderAttachment_TicketAttachmentId", table: "BusinessTripExpenses", column: "TicketAttachmentId", principalTable: "OrderAttachment", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_BusinessTripExpenses_OrderAttachment_TransportationAttachmentId", table: "BusinessTripExpenses", column: "TransportationAttachmentId", principalTable: "OrderAttachment", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_OverTimeDay_OrderAttachment_OverTimeAttachmentId", table: "OverTimeDay", column: "OverTimeAttachmentId", principalTable: "OrderAttachment", principalColumn: "Id"); } } }