using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWorkHR.Infrastructure.Migrations
{
///
public partial class altrOrder : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DateActioned",
table: "OrderRequests");
migrationBuilder.DropColumn(
name: "DateRequested",
table: "OrderRequests");
migrationBuilder.DropColumn(
name: "IsApproved",
table: "OrderRequests");
migrationBuilder.DropColumn(
name: "IsCancelled",
table: "OrderRequests");
migrationBuilder.AlterColumn(
name: "EndDate",
table: "OrderRequests",
type: "datetime2",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime2");
migrationBuilder.AddColumn(
name: "CityId",
table: "OrderRequests",
type: "int",
nullable: true);
migrationBuilder.AddColumn(
name: "CountryId",
table: "OrderRequests",
type: "int",
nullable: true);
migrationBuilder.AddColumn(
name: "LeaveTypeId",
table: "OrderRequests",
type: "bigint",
nullable: true);
migrationBuilder.AddColumn(
name: "OrderStatus",
table: "OrderRequests",
type: "int",
nullable: true);
migrationBuilder.CreateTable(
name: "LeaveTypes",
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_LeaveTypes", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_OrderRequests_LeaveTypeId",
table: "OrderRequests",
column: "LeaveTypeId");
migrationBuilder.AddForeignKey(
name: "FK_OrderRequests_LeaveTypes_LeaveTypeId",
table: "OrderRequests",
column: "LeaveTypeId",
principalTable: "LeaveTypes",
principalColumn: "Id");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrderRequests_LeaveTypes_LeaveTypeId",
table: "OrderRequests");
migrationBuilder.DropTable(
name: "LeaveTypes");
migrationBuilder.DropIndex(
name: "IX_OrderRequests_LeaveTypeId",
table: "OrderRequests");
migrationBuilder.DropColumn(
name: "CityId",
table: "OrderRequests");
migrationBuilder.DropColumn(
name: "CountryId",
table: "OrderRequests");
migrationBuilder.DropColumn(
name: "LeaveTypeId",
table: "OrderRequests");
migrationBuilder.DropColumn(
name: "OrderStatus",
table: "OrderRequests");
migrationBuilder.AlterColumn(
name: "EndDate",
table: "OrderRequests",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "datetime2",
oldNullable: true);
migrationBuilder.AddColumn(
name: "DateActioned",
table: "OrderRequests",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn(
name: "DateRequested",
table: "OrderRequests",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn(
name: "IsApproved",
table: "OrderRequests",
type: "bit",
nullable: true);
migrationBuilder.AddColumn(
name: "IsCancelled",
table: "OrderRequests",
type: "bit",
nullable: false,
defaultValue: false);
}
}
}