using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PowderCoating.Infrastructure.Migrations
{
///
public partial class AddBankReconciliation : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "ClearedDate",
table: "Payments",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn(
name: "IsCleared",
table: "Payments",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn(
name: "ClearedDate",
table: "Expenses",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn(
name: "IsCleared",
table: "Expenses",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn(
name: "ClearedDate",
table: "BillPayments",
type: "datetime2",
nullable: true);
migrationBuilder.AddColumn(
name: "IsCleared",
table: "BillPayments",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "BankReconciliations",
columns: table => new
{
Id = table.Column(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
AccountId = table.Column(type: "int", nullable: false),
StatementDate = table.Column(type: "datetime2", nullable: false),
BeginningBalance = table.Column(type: "decimal(18,2)", nullable: false),
EndingBalance = table.Column(type: "decimal(18,2)", nullable: false),
Status = table.Column(type: "int", nullable: false),
CompletedAt = table.Column(type: "datetime2", nullable: true),
CompletedBy = table.Column(type: "nvarchar(max)", nullable: true),
Notes = table.Column(type: "nvarchar(max)", nullable: true),
CompanyId = table.Column(type: "int", nullable: false),
CreatedAt = table.Column(type: "datetime2", nullable: false),
UpdatedAt = table.Column(type: "datetime2", nullable: true),
CreatedBy = table.Column(type: "nvarchar(max)", nullable: true),
UpdatedBy = table.Column(type: "nvarchar(max)", nullable: true),
IsDeleted = table.Column(type: "bit", nullable: false),
DeletedAt = table.Column(type: "datetime2", nullable: true),
DeletedBy = table.Column(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BankReconciliations", x => x.Id);
table.ForeignKey(
name: "FK_BankReconciliations_Accounts_AccountId",
column: x => x.AccountId,
principalTable: "Accounts",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 5, 10, 4, 6, 6, 200, DateTimeKind.Utc).AddTicks(8472));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 5, 10, 4, 6, 6, 200, DateTimeKind.Utc).AddTicks(8478));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 5, 10, 4, 6, 6, 200, DateTimeKind.Utc).AddTicks(8479));
migrationBuilder.CreateIndex(
name: "IX_BankReconciliations_AccountId",
table: "BankReconciliations",
column: "AccountId");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BankReconciliations");
migrationBuilder.DropColumn(
name: "ClearedDate",
table: "Payments");
migrationBuilder.DropColumn(
name: "IsCleared",
table: "Payments");
migrationBuilder.DropColumn(
name: "ClearedDate",
table: "Expenses");
migrationBuilder.DropColumn(
name: "IsCleared",
table: "Expenses");
migrationBuilder.DropColumn(
name: "ClearedDate",
table: "BillPayments");
migrationBuilder.DropColumn(
name: "IsCleared",
table: "BillPayments");
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 5, 10, 3, 58, 27, 360, DateTimeKind.Utc).AddTicks(6994));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 5, 10, 3, 58, 27, 360, DateTimeKind.Utc).AddTicks(7001));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 5, 10, 3, 58, 27, 360, DateTimeKind.Utc).AddTicks(7003));
}
}
}