219 lines
11 KiB
C#
219 lines
11 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace PowderCoating.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddAppointmentScheduling : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AppointmentStatusLookups",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
StatusCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
DisplayName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
DisplayOrder = table.Column<int>(type: "int", nullable: false),
|
|
ColorClass = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
IconClass = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
|
IsSystemDefined = table.Column<bool>(type: "bit", nullable: false),
|
|
IsTerminalStatus = table.Column<bool>(type: "bit", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", 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_AppointmentStatusLookups", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AppointmentTypeLookups",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
TypeCode = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
DisplayName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
DisplayOrder = table.Column<int>(type: "int", nullable: false),
|
|
ColorClass = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
IconClass = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
RequiresJobLink = table.Column<bool>(type: "bit", nullable: false),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
|
IsSystemDefined = table.Column<bool>(type: "bit", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", 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_AppointmentTypeLookups", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Appointments",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
AppointmentNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
CustomerId = table.Column<int>(type: "int", nullable: false),
|
|
JobId = table.Column<int>(type: "int", nullable: true),
|
|
AppointmentStatusId = table.Column<int>(type: "int", nullable: false),
|
|
AppointmentTypeId = table.Column<int>(type: "int", nullable: false),
|
|
AssignedWorkerId = table.Column<int>(type: "int", nullable: true),
|
|
ScheduledStartTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
ScheduledEndTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
IsAllDay = table.Column<bool>(type: "bit", nullable: false),
|
|
ActualStartTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
ActualEndTime = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
Location = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsReminderEnabled = table.Column<bool>(type: "bit", nullable: false),
|
|
ReminderMinutesBefore = table.Column<int>(type: "int", nullable: false),
|
|
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_Appointments", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Appointments_AppointmentStatusLookups_AppointmentStatusId",
|
|
column: x => x.AppointmentStatusId,
|
|
principalTable: "AppointmentStatusLookups",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Appointments_AppointmentTypeLookups_AppointmentTypeId",
|
|
column: x => x.AppointmentTypeId,
|
|
principalTable: "AppointmentTypeLookups",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Appointments_Customers_CustomerId",
|
|
column: x => x.CustomerId,
|
|
principalTable: "Customers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_Appointments_Jobs_JobId",
|
|
column: x => x.JobId,
|
|
principalTable: "Jobs",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_Appointments_ShopWorkers_AssignedWorkerId",
|
|
column: x => x.AssignedWorkerId,
|
|
principalTable: "ShopWorkers",
|
|
principalColumn: "Id");
|
|
});
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 2, 14, 22, 13, 31, 263, DateTimeKind.Utc).AddTicks(3342));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 2, 14, 22, 13, 31, 263, DateTimeKind.Utc).AddTicks(3348));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 3,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 2, 14, 22, 13, 31, 263, DateTimeKind.Utc).AddTicks(3349));
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Appointments_AppointmentStatusId",
|
|
table: "Appointments",
|
|
column: "AppointmentStatusId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Appointments_AppointmentTypeId",
|
|
table: "Appointments",
|
|
column: "AppointmentTypeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Appointments_AssignedWorkerId",
|
|
table: "Appointments",
|
|
column: "AssignedWorkerId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Appointments_CustomerId",
|
|
table: "Appointments",
|
|
column: "CustomerId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Appointments_JobId",
|
|
table: "Appointments",
|
|
column: "JobId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Appointments");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AppointmentStatusLookups");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AppointmentTypeLookups");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 1,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 2, 14, 18, 29, 1, 450, DateTimeKind.Utc).AddTicks(5899));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 2,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 2, 14, 18, 29, 1, 450, DateTimeKind.Utc).AddTicks(5906));
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "PricingTiers",
|
|
keyColumn: "Id",
|
|
keyValue: 3,
|
|
column: "CreatedAt",
|
|
value: new DateTime(2026, 2, 14, 18, 29, 1, 450, DateTimeKind.Utc).AddTicks(5907));
|
|
}
|
|
}
|
|
}
|