|
@@ -0,0 +1,231 @@
|
|
|
+using System;
|
|
|
+using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
+
|
|
|
+#nullable disable
|
|
|
+
|
|
|
+#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
+
|
|
|
+namespace MTWorkHR.Infrastructure.Migrations
|
|
|
+{
|
|
|
+ /// <inheritdoc />
|
|
|
+ public partial class altrOrderRequest3 : Migration
|
|
|
+ {
|
|
|
+ /// <inheritdoc />
|
|
|
+ protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
+ {
|
|
|
+ migrationBuilder.DropColumn(
|
|
|
+ name: "CityId",
|
|
|
+ table: "OrderRequests");
|
|
|
+
|
|
|
+ migrationBuilder.DropColumn(
|
|
|
+ name: "CountryId",
|
|
|
+ table: "OrderRequests");
|
|
|
+
|
|
|
+ migrationBuilder.AddColumn<long>(
|
|
|
+ name: "BusinessTripExpensesId",
|
|
|
+ table: "OrderRequests",
|
|
|
+ type: "bigint",
|
|
|
+ nullable: true);
|
|
|
+
|
|
|
+ migrationBuilder.CreateTable(
|
|
|
+ name: "OrderAttachment",
|
|
|
+ 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),
|
|
|
+ OrderRequestId = table.Column<long>(type: "bigint", nullable: false),
|
|
|
+ AttachmentTypeId = table.Column<long>(type: "bigint", nullable: true),
|
|
|
+ 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_OrderAttachment", x => x.Id);
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_OrderAttachment_OrderRequests_OrderRequestId",
|
|
|
+ column: x => x.OrderRequestId,
|
|
|
+ principalTable: "OrderRequests",
|
|
|
+ principalColumn: "Id",
|
|
|
+ onDelete: ReferentialAction.Cascade);
|
|
|
+ });
|
|
|
+
|
|
|
+ migrationBuilder.CreateTable(
|
|
|
+ name: "OverTimeDay",
|
|
|
+ columns: table => new
|
|
|
+ {
|
|
|
+ Id = table.Column<long>(type: "bigint", nullable: false)
|
|
|
+ .Annotation("SqlServer:Identity", "1, 1"),
|
|
|
+ OverTimeDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
|
+ StartTime = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
+ EndTime = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
|
+ TotalHours = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
|
+ OrderRequestId = table.Column<long>(type: "bigint", nullable: true)
|
|
|
+ },
|
|
|
+ constraints: table =>
|
|
|
+ {
|
|
|
+ table.PrimaryKey("PK_OverTimeDay", x => x.Id);
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_OverTimeDay_OrderRequests_OrderRequestId",
|
|
|
+ column: x => x.OrderRequestId,
|
|
|
+ principalTable: "OrderRequests",
|
|
|
+ principalColumn: "Id");
|
|
|
+ });
|
|
|
+
|
|
|
+ migrationBuilder.CreateTable(
|
|
|
+ name: "BusinessTripExpenses",
|
|
|
+ columns: table => new
|
|
|
+ {
|
|
|
+ Id = table.Column<long>(type: "bigint", nullable: false)
|
|
|
+ .Annotation("SqlServer:Identity", "1, 1"),
|
|
|
+ TicketCost = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
|
+ TransportationCost = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
|
+ AccommodationCost = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
|
+ OtherCost = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
|
+ TicketAttachmentId = table.Column<long>(type: "bigint", nullable: true),
|
|
|
+ TransportationAttachmentId = table.Column<long>(type: "bigint", nullable: true),
|
|
|
+ AccommodationAttachmentId = table.Column<long>(type: "bigint", nullable: true),
|
|
|
+ OtherAttachmentId = table.Column<long>(type: "bigint", nullable: true)
|
|
|
+ },
|
|
|
+ constraints: table =>
|
|
|
+ {
|
|
|
+ table.PrimaryKey("PK_BusinessTripExpenses", x => x.Id);
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_BusinessTripExpenses_OrderAttachment_AccommodationAttachmentId",
|
|
|
+ column: x => x.AccommodationAttachmentId,
|
|
|
+ principalTable: "OrderAttachment",
|
|
|
+ principalColumn: "Id");
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_BusinessTripExpenses_OrderAttachment_OtherAttachmentId",
|
|
|
+ column: x => x.OtherAttachmentId,
|
|
|
+ principalTable: "OrderAttachment",
|
|
|
+ principalColumn: "Id");
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_BusinessTripExpenses_OrderAttachment_TicketAttachmentId",
|
|
|
+ column: x => x.TicketAttachmentId,
|
|
|
+ principalTable: "OrderAttachment",
|
|
|
+ principalColumn: "Id");
|
|
|
+ table.ForeignKey(
|
|
|
+ name: "FK_BusinessTripExpenses_OrderAttachment_TransportationAttachmentId",
|
|
|
+ column: x => x.TransportationAttachmentId,
|
|
|
+ principalTable: "OrderAttachment",
|
|
|
+ principalColumn: "Id");
|
|
|
+ });
|
|
|
+
|
|
|
+ migrationBuilder.InsertData(
|
|
|
+ table: "AttachmentTypes",
|
|
|
+ columns: new[] { "Id", "IsRequired", "NameAr", "NameEn" },
|
|
|
+ values: new object[,]
|
|
|
+ {
|
|
|
+ { 10L, false, "تكلفة التذكرة", "Ticket Cost" },
|
|
|
+ { 11L, false, "تكلفة المواصلات", "Transportation Cost" },
|
|
|
+ { 12L, false, "تكلفة الاقامة", "Accommodation Cost" },
|
|
|
+ { 13L, false, "اخرى", "Other" }
|
|
|
+ });
|
|
|
+
|
|
|
+ migrationBuilder.CreateIndex(
|
|
|
+ name: "IX_OrderRequests_BusinessTripExpensesId",
|
|
|
+ table: "OrderRequests",
|
|
|
+ column: "BusinessTripExpensesId");
|
|
|
+
|
|
|
+ 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.CreateIndex(
|
|
|
+ name: "IX_OrderAttachment_OrderRequestId",
|
|
|
+ table: "OrderAttachment",
|
|
|
+ column: "OrderRequestId");
|
|
|
+
|
|
|
+ migrationBuilder.CreateIndex(
|
|
|
+ name: "IX_OverTimeDay_OrderRequestId",
|
|
|
+ table: "OverTimeDay",
|
|
|
+ column: "OrderRequestId");
|
|
|
+
|
|
|
+ migrationBuilder.AddForeignKey(
|
|
|
+ name: "FK_OrderRequests_BusinessTripExpenses_BusinessTripExpensesId",
|
|
|
+ table: "OrderRequests",
|
|
|
+ column: "BusinessTripExpensesId",
|
|
|
+ principalTable: "BusinessTripExpenses",
|
|
|
+ principalColumn: "Id");
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <inheritdoc />
|
|
|
+ protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
+ {
|
|
|
+ migrationBuilder.DropForeignKey(
|
|
|
+ name: "FK_OrderRequests_BusinessTripExpenses_BusinessTripExpensesId",
|
|
|
+ table: "OrderRequests");
|
|
|
+
|
|
|
+ migrationBuilder.DropTable(
|
|
|
+ name: "BusinessTripExpenses");
|
|
|
+
|
|
|
+ migrationBuilder.DropTable(
|
|
|
+ name: "OverTimeDay");
|
|
|
+
|
|
|
+ migrationBuilder.DropTable(
|
|
|
+ name: "OrderAttachment");
|
|
|
+
|
|
|
+ migrationBuilder.DropIndex(
|
|
|
+ name: "IX_OrderRequests_BusinessTripExpensesId",
|
|
|
+ table: "OrderRequests");
|
|
|
+
|
|
|
+ migrationBuilder.DeleteData(
|
|
|
+ table: "AttachmentTypes",
|
|
|
+ keyColumn: "Id",
|
|
|
+ keyValue: 10L);
|
|
|
+
|
|
|
+ migrationBuilder.DeleteData(
|
|
|
+ table: "AttachmentTypes",
|
|
|
+ keyColumn: "Id",
|
|
|
+ keyValue: 11L);
|
|
|
+
|
|
|
+ migrationBuilder.DeleteData(
|
|
|
+ table: "AttachmentTypes",
|
|
|
+ keyColumn: "Id",
|
|
|
+ keyValue: 12L);
|
|
|
+
|
|
|
+ migrationBuilder.DeleteData(
|
|
|
+ table: "AttachmentTypes",
|
|
|
+ keyColumn: "Id",
|
|
|
+ keyValue: 13L);
|
|
|
+
|
|
|
+ migrationBuilder.DropColumn(
|
|
|
+ name: "BusinessTripExpensesId",
|
|
|
+ table: "OrderRequests");
|
|
|
+
|
|
|
+ migrationBuilder.AddColumn<int>(
|
|
|
+ name: "CityId",
|
|
|
+ table: "OrderRequests",
|
|
|
+ type: "int",
|
|
|
+ nullable: true);
|
|
|
+
|
|
|
+ migrationBuilder.AddColumn<int>(
|
|
|
+ name: "CountryId",
|
|
|
+ table: "OrderRequests",
|
|
|
+ type: "int",
|
|
|
+ nullable: true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|