152 lines
5.7 KiB
C#
152 lines
5.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddLeaveCancelDocandReasontoLeaveRequest : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
//migrationBuilder.DropForeignKey(
|
|
// name: "FK_LeaveRequests_Document_LeaveDocumentId",
|
|
// table: "LeaveRequests");
|
|
|
|
//migrationBuilder.DropForeignKey(
|
|
// name: "FK_LeaveRequests_Document_LeaveDraftDocumentId",
|
|
// table: "LeaveRequests");
|
|
|
|
migrationBuilder.AlterColumn<Guid>(
|
|
name: "LeaveDraftDocumentId",
|
|
table: "LeaveRequests",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci",
|
|
oldClrType: typeof(Guid),
|
|
oldType: "char(36)")
|
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
|
|
|
migrationBuilder.AlterColumn<Guid>(
|
|
name: "LeaveDocumentId",
|
|
table: "LeaveRequests",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci",
|
|
oldClrType: typeof(Guid),
|
|
oldType: "char(36)")
|
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "LeaveCancelComment",
|
|
table: "LeaveRequests",
|
|
type: "longtext",
|
|
nullable: true,
|
|
comment: "เหตุผลในการขอยกเลิก")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "LeaveCancelDocumentId",
|
|
table: "LeaveRequests",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_LeaveRequests_LeaveCancelDocumentId",
|
|
table: "LeaveRequests",
|
|
column: "LeaveCancelDocumentId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_LeaveRequests_Document_LeaveCancelDocumentId",
|
|
table: "LeaveRequests",
|
|
column: "LeaveCancelDocumentId",
|
|
principalTable: "Document",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_LeaveRequests_Document_LeaveDocumentId",
|
|
table: "LeaveRequests",
|
|
column: "LeaveDocumentId",
|
|
principalTable: "Document",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_LeaveRequests_Document_LeaveDraftDocumentId",
|
|
table: "LeaveRequests",
|
|
column: "LeaveDraftDocumentId",
|
|
principalTable: "Document",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_LeaveRequests_Document_LeaveCancelDocumentId",
|
|
table: "LeaveRequests");
|
|
|
|
//migrationBuilder.DropForeignKey(
|
|
// name: "FK_LeaveRequests_Document_LeaveDocumentId",
|
|
// table: "LeaveRequests");
|
|
|
|
//migrationBuilder.DropForeignKey(
|
|
// name: "FK_LeaveRequests_Document_LeaveDraftDocumentId",
|
|
// table: "LeaveRequests");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_LeaveRequests_LeaveCancelDocumentId",
|
|
table: "LeaveRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "LeaveCancelComment",
|
|
table: "LeaveRequests");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "LeaveCancelDocumentId",
|
|
table: "LeaveRequests");
|
|
|
|
migrationBuilder.AlterColumn<Guid>(
|
|
name: "LeaveDraftDocumentId",
|
|
table: "LeaveRequests",
|
|
type: "char(36)",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|
collation: "ascii_general_ci",
|
|
oldClrType: typeof(Guid),
|
|
oldType: "char(36)",
|
|
oldNullable: true)
|
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
|
|
|
migrationBuilder.AlterColumn<Guid>(
|
|
name: "LeaveDocumentId",
|
|
table: "LeaveRequests",
|
|
type: "char(36)",
|
|
nullable: false,
|
|
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
|
collation: "ascii_general_ci",
|
|
oldClrType: typeof(Guid),
|
|
oldType: "char(36)",
|
|
oldNullable: true)
|
|
.OldAnnotation("Relational:Collation", "ascii_general_ci");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_LeaveRequests_Document_LeaveDocumentId",
|
|
table: "LeaveRequests",
|
|
column: "LeaveDocumentId",
|
|
principalTable: "Document",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_LeaveRequests_Document_LeaveDraftDocumentId",
|
|
table: "LeaveRequests",
|
|
column: "LeaveDraftDocumentId",
|
|
principalTable: "Document",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|