marco.pms.api/Marco.Pms.DataAccess/Migrations/20251101085801_Made_UpdatedBy_And_UpdateAt_As_Nullable.cs

146 lines
5.4 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
/// <inheritdoc />
public partial class Made_UpdatedBy_And_UpdateAt_As_Nullable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PaymentRequests_Employees_UpdatedById",
table: "PaymentRequests");
migrationBuilder.DropForeignKey(
name: "FK_RecurringPayments_Employees_UpdatedById",
table: "RecurringPayments");
migrationBuilder.AlterColumn<Guid>(
name: "UpdatedById",
table: "RecurringPayments",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedAt",
table: "RecurringPayments",
type: "datetime(6)",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime(6)");
migrationBuilder.AlterColumn<Guid>(
name: "UpdatedById",
table: "PaymentRequests",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<DateTime>(
name: "UpdatedAt",
table: "PaymentRequests",
type: "datetime(6)",
nullable: true,
oldClrType: typeof(DateTime),
oldType: "datetime(6)");
migrationBuilder.AddForeignKey(
name: "FK_PaymentRequests_Employees_UpdatedById",
table: "PaymentRequests",
column: "UpdatedById",
principalTable: "Employees",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_RecurringPayments_Employees_UpdatedById",
table: "RecurringPayments",
column: "UpdatedById",
principalTable: "Employees",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PaymentRequests_Employees_UpdatedById",
table: "PaymentRequests");
migrationBuilder.DropForeignKey(
name: "FK_RecurringPayments_Employees_UpdatedById",
table: "RecurringPayments");
migrationBuilder.AlterColumn<Guid>(
name: "UpdatedById",
table: "RecurringPayments",
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<DateTime>(
name: "UpdatedAt",
table: "RecurringPayments",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true);
migrationBuilder.AlterColumn<Guid>(
name: "UpdatedById",
table: "PaymentRequests",
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<DateTime>(
name: "UpdatedAt",
table: "PaymentRequests",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
oldClrType: typeof(DateTime),
oldType: "datetime(6)",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_PaymentRequests_Employees_UpdatedById",
table: "PaymentRequests",
column: "UpdatedById",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecurringPayments_Employees_UpdatedById",
table: "RecurringPayments",
column: "UpdatedById",
principalTable: "Employees",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}