149 lines
6.5 KiB
C#
149 lines
6.5 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PowderCoating.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddDeposits : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Deposits",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
ReceiptNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
CustomerId = table.Column<int>(type: "int", nullable: false),
|
|
JobId = table.Column<int>(type: "int", nullable: true),
|
|
QuoteId = table.Column<int>(type: "int", nullable: true),
|
|
Amount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
PaymentMethod = table.Column<int>(type: "int", nullable: false),
|
|
ReceivedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
Reference = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
RecordedById = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
|
AppliedToInvoiceId = table.Column<int>(type: "int", nullable: true),
|
|
AppliedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
CompanyId = table.Column<int>(type: "int", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
|
DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
DeletedBy = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Deposits", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Deposits_AspNetUsers_RecordedById",
|
|
column: x => x.RecordedById,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_Deposits_Customers_CustomerId",
|
|
column: x => x.CustomerId,
|
|
principalTable: "Customers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Deposits_Invoices_AppliedToInvoiceId",
|
|
column: x => x.AppliedToInvoiceId,
|
|
principalTable: "Invoices",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
table.ForeignKey(
|
|
name: "FK_Deposits_Jobs_JobId",
|
|
column: x => x.JobId,
|
|
principalTable: "Jobs",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_Deposits_Quotes_QuoteId",
|
|
column: x => x.QuoteId,
|
|
principalTable: "Quotes",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 3, 29, 0, 58, 35, 757, DateTimeKind.Utc).AddTicks(6949));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 3, 29, 0, 58, 35, 757, DateTimeKind.Utc).AddTicks(6955));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 3,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 3, 29, 0, 58, 35, 757, DateTimeKind.Utc).AddTicks(6957));
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Deposits_AppliedToInvoiceId",
|
|
table: "Deposits",
|
|
column: "AppliedToInvoiceId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Deposits_CustomerId",
|
|
table: "Deposits",
|
|
column: "CustomerId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Deposits_JobId",
|
|
table: "Deposits",
|
|
column: "JobId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Deposits_QuoteId",
|
|
table: "Deposits",
|
|
column: "QuoteId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Deposits_RecordedById",
|
|
table: "Deposits",
|
|
column: "RecordedById");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Deposits");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 3, 29, 0, 32, 56, 736, DateTimeKind.Utc).AddTicks(8710));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 3, 29, 0, 32, 56, 736, DateTimeKind.Utc).AddTicks(8717));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 3,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 3, 29, 0, 32, 56, 736, DateTimeKind.Utc).AddTicks(8718));
|
|
}
|
|
}
|
|
}
|