123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- using System;
- using Microsoft.EntityFrameworkCore.Migrations;
- #nullable disable
- namespace MTWorkHR.Infrastructure.Migrations
- {
- /// <inheritdoc />
- public partial class altrOrderRequestAttach : Migration
- {
- /// <inheritdoc />
- 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<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
- BusinessTripExpensesId = table.Column<long>(type: "bigint", nullable: false),
- FileName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
- OriginalName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
- FilePath = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ContentType = table.Column<string>(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<long>(type: "bigint", nullable: false)
- .Annotation("SqlServer:Identity", "1, 1"),
- CreateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- UpdateUser = table.Column<string>(type: "nvarchar(450)", maxLength: 450, nullable: true),
- CreateDate = table.Column<DateTime>(type: "datetime2", nullable: false),
- UpdateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
- OverTimeDayId = table.Column<long>(type: "bigint", nullable: false),
- FileName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
- OriginalName = table.Column<string>(type: "nvarchar(250)", maxLength: 250, nullable: true),
- FilePath = table.Column<string>(type: "nvarchar(max)", nullable: true),
- ContentType = table.Column<string>(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);
- }
- /// <inheritdoc />
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropTable(
- name: "BusinessTripAttachment");
- migrationBuilder.DropTable(
- name: "OverTimeDayAttachment");
- migrationBuilder.AddColumn<long>(
- name: "OverTimeAttachmentId",
- table: "OverTimeDay",
- type: "bigint",
- nullable: true);
- migrationBuilder.AddColumn<long>(
- name: "AccommodationAttachmentId",
- table: "BusinessTripExpenses",
- type: "bigint",
- nullable: true);
- migrationBuilder.AddColumn<long>(
- name: "OtherAttachmentId",
- table: "BusinessTripExpenses",
- type: "bigint",
- nullable: true);
- migrationBuilder.AddColumn<long>(
- name: "TicketAttachmentId",
- table: "BusinessTripExpenses",
- type: "bigint",
- nullable: true);
- migrationBuilder.AddColumn<long>(
- 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");
- }
- }
- }
|