using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MTWorkHR.Infrastructure.Migrations
{
///
public partial class altrContractWorkingDay : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "WorkingDays",
table: "Contracts");
migrationBuilder.AlterColumn(
name: "WorkingHoursNum",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "WorkingHours",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "WorkStateId",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "WorkCountryId",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "WhoCanTerminateContractInTrial",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "WhoCanTerminateContract",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "VacationDays",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "NoticePeriodBeforeTermination",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "ContractorTaxResidencyId",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "ContractDurationId",
table: "Contracts",
type: "int",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.AlterColumn(
name: "BillingCycle",
table: "Contracts",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(int),
oldType: "int");
migrationBuilder.CreateTable(
name: "ContractWorkingDay",
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),
ContractId = table.Column(type: "bigint", nullable: false),
WorkingDay = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ContractWorkingDay", x => x.Id);
table.ForeignKey(
name: "FK_ContractWorkingDay_Contracts_ContractId",
column: x => x.ContractId,
principalTable: "Contracts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ContractWorkingDay_ContractId",
table: "ContractWorkingDay",
column: "ContractId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ContractWorkingDay");
migrationBuilder.AlterColumn(
name: "WorkingHoursNum",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "WorkingHours",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "WorkStateId",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "WorkCountryId",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "WhoCanTerminateContractInTrial",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "WhoCanTerminateContract",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "VacationDays",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "NoticePeriodBeforeTermination",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ContractorTaxResidencyId",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "ContractDurationId",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "int",
oldNullable: true);
migrationBuilder.AlterColumn(
name: "BillingCycle",
table: "Contracts",
type: "int",
nullable: false,
defaultValue: 0,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AddColumn(
name: "WorkingDays",
table: "Contracts",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
}
}
}