Files
PowderCoatingLogix/src/PowderCoating.Infrastructure/Migrations/20260409013822_AddInAppNotifications.cs
T
2026-04-23 21:38:24 -04:00

124 lines
5.4 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PowderCoating.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddInAppNotifications : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "InAppNotifications",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Message = table.Column<string>(type: "nvarchar(max)", nullable: false),
Link = table.Column<string>(type: "nvarchar(max)", nullable: true),
NotificationType = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsRead = table.Column<bool>(type: "bit", nullable: false),
ReadAt = table.Column<DateTime>(type: "datetime2", nullable: true),
QuoteId = table.Column<int>(type: "int", nullable: true),
InvoiceId = table.Column<int>(type: "int", nullable: true),
CustomerId = table.Column<int>(type: "int", 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_InAppNotifications", x => x.Id);
table.ForeignKey(
name: "FK_InAppNotifications_Customers_CustomerId",
column: x => x.CustomerId,
principalTable: "Customers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_InAppNotifications_Invoices_InvoiceId",
column: x => x.InvoiceId,
principalTable: "Invoices",
principalColumn: "Id");
table.ForeignKey(
name: "FK_InAppNotifications_Quotes_QuoteId",
column: x => x.QuoteId,
principalTable: "Quotes",
principalColumn: "Id");
});
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 4, 9, 1, 38, 18, 363, DateTimeKind.Utc).AddTicks(787));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 4, 9, 1, 38, 18, 363, DateTimeKind.Utc).AddTicks(794));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 4, 9, 1, 38, 18, 363, DateTimeKind.Utc).AddTicks(795));
migrationBuilder.CreateIndex(
name: "IX_InAppNotifications_CustomerId",
table: "InAppNotifications",
column: "CustomerId");
migrationBuilder.CreateIndex(
name: "IX_InAppNotifications_InvoiceId",
table: "InAppNotifications",
column: "InvoiceId");
migrationBuilder.CreateIndex(
name: "IX_InAppNotifications_QuoteId",
table: "InAppNotifications",
column: "QuoteId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InAppNotifications");
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 1,
column: "CreatedAt",
value: new DateTime(2026, 4, 8, 20, 53, 42, 294, DateTimeKind.Utc).AddTicks(7842));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 2,
column: "CreatedAt",
value: new DateTime(2026, 4, 8, 20, 53, 42, 294, DateTimeKind.Utc).AddTicks(7847));
migrationBuilder.UpdateData(
table: "PricingTiers",
keyColumn: "Id",
keyValue: 3,
column: "CreatedAt",
value: new DateTime(2026, 4, 8, 20, 53, 42, 294, DateTimeKind.Utc).AddTicks(7849));
}
}
}