using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable #pragma warning disable CA1814 // Prefer jagged arrays over multidimensional namespace MTWorkHR.Infrastructure.Migrations { /// public partial class orderReq : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "OrderTypes", 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), NameAr = table.Column(type: "nvarchar(max)", nullable: false), NameEn = table.Column(type: "nvarchar(max)", nullable: false), DefaultDays = table.Column(type: "int", nullable: false) }, constraints: table => { table.PrimaryKey("PK_OrderTypes", x => x.Id); }); migrationBuilder.CreateTable( name: "OrderAllocations", 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), NumberOfDays = table.Column(type: "int", nullable: false), OrderTypeId = table.Column(type: "bigint", nullable: false), Period = table.Column(type: "int", nullable: false), EmployeeId = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_OrderAllocations", x => x.Id); table.ForeignKey( name: "FK_OrderAllocations_OrderTypes_OrderTypeId", column: x => x.OrderTypeId, principalTable: "OrderTypes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "OrderRequests", 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), IsDeleted = table.Column(type: "bit", nullable: false), DeleteUserId = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), StartDate = table.Column(type: "datetime2", nullable: false), EndDate = table.Column(type: "datetime2", nullable: false), OrderTypeId = table.Column(type: "bigint", nullable: false), DateRequested = table.Column(type: "datetime2", nullable: false), RequestComments = table.Column(type: "nvarchar(max)", nullable: true), DateActioned = table.Column(type: "datetime2", nullable: true), IsApproved = table.Column(type: "bit", nullable: true), IsCancelled = table.Column(type: "bit", nullable: false), RequestingEmployeeId = table.Column(type: "nvarchar(max)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_OrderRequests", x => x.Id); table.ForeignKey( name: "FK_OrderRequests_OrderTypes_OrderTypeId", column: x => x.OrderTypeId, principalTable: "OrderTypes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.InsertData( table: "OrderTypes", columns: new[] { "Id", "CreateDate", "CreateUser", "DefaultDays", "NameAr", "NameEn", "UpdateDate", "UpdateUser" }, values: new object[,] { { 1L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, 2, "إذن", "Leave", null, null }, { 2L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, 15, "أجازة مرضية", "Sick Leave", null, null }, { 3L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, 20, "وقت إضافي", "Overtime", null, null }, { 4L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, 0, "رحلة عمل", "Business trip", null, null }, { 5L, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, 0, "دورة تدريبية", "Course", null, null } }); migrationBuilder.CreateIndex( name: "IX_OrderAllocations_OrderTypeId", table: "OrderAllocations", column: "OrderTypeId"); migrationBuilder.CreateIndex( name: "IX_OrderRequests_OrderTypeId", table: "OrderRequests", column: "OrderTypeId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "OrderAllocations"); migrationBuilder.DropTable( name: "OrderRequests"); migrationBuilder.DropTable( name: "OrderTypes"); } } }