1018 lines
58 KiB
C#
1018 lines
58 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
|
|
|
namespace PowderCoating.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class InitialCreate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetRoles",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
Name = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
NormalizedName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetRoles", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUsers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
EmployeeNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
DateOfBirth = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
HireDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
TerminationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
Address = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
City = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
State = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ZipCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Department = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Position = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
HourlyRate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
Theme = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
DateFormat = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
TimeZone = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
DashboardLayout = table.Column<int>(type: "int", nullable: true),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
|
CanViewShopFloor = table.Column<bool>(type: "bit", nullable: false),
|
|
CanManageJobs = table.Column<bool>(type: "bit", nullable: false),
|
|
CanManageInventory = table.Column<bool>(type: "bit", nullable: false),
|
|
CanManageCustomers = table.Column<bool>(type: "bit", nullable: false),
|
|
CanCreateQuotes = table.Column<bool>(type: "bit", nullable: false),
|
|
CanApproveQuotes = table.Column<bool>(type: "bit", nullable: false),
|
|
ProfilePicturePath = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
LastLoginDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
UserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
NormalizedUserName = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
Email = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
NormalizedEmail = table.Column<string>(type: "nvarchar(256)", maxLength: 256, nullable: true),
|
|
EmailConfirmed = table.Column<bool>(type: "bit", nullable: false),
|
|
PasswordHash = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
SecurityStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ConcurrencyStamp = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
PhoneNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
PhoneNumberConfirmed = table.Column<bool>(type: "bit", nullable: false),
|
|
TwoFactorEnabled = table.Column<bool>(type: "bit", nullable: false),
|
|
LockoutEnd = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true),
|
|
LockoutEnabled = table.Column<bool>(type: "bit", nullable: false),
|
|
AccessFailedCount = table.Column<int>(type: "int", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUsers", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Equipment",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
EquipmentName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
EquipmentNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
EquipmentType = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Manufacturer = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Model = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
SerialNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
PurchaseDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
PurchasePrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
WarrantyExpiration = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
Location = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
RecommendedMaintenanceIntervalDays = table.Column<int>(type: "int", nullable: false),
|
|
LastMaintenanceDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
NextScheduledMaintenance = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsActive = table.Column<bool>(type: "bit", 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_Equipment", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PricingTiers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
TierName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
DiscountPercent = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
IsActive = table.Column<bool>(type: "bit", 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_PricingTiers", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Suppliers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
ContactName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Phone = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Address = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
City = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
State = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ZipCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Country = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Website = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsActive = table.Column<bool>(type: "bit", 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_Suppliers", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetRoleClaims",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
|
|
column: x => x.RoleId,
|
|
principalTable: "AspNetRoles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserClaims",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
ClaimType = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ClaimValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserClaims_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserLogins",
|
|
columns: table => new
|
|
{
|
|
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
ProviderKey = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
ProviderDisplayName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserLogins_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserRoles",
|
|
columns: table => new
|
|
{
|
|
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
RoleId = table.Column<string>(type: "nvarchar(450)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
|
|
column: x => x.RoleId,
|
|
principalTable: "AspNetRoles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserRoles_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AspNetUserTokens",
|
|
columns: table => new
|
|
{
|
|
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
LoginProvider = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
Name = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
Value = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
|
|
table.ForeignKey(
|
|
name: "FK_AspNetUserTokens_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "MaintenanceRecords",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
EquipmentId = table.Column<int>(type: "int", nullable: false),
|
|
MaintenanceType = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
Priority = table.Column<int>(type: "int", nullable: false),
|
|
ScheduledDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
CompletedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
PerformedById = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
WorkPerformed = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
PartsReplaced = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
LaborCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
PartsCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
TotalCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
DowntimeHours = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
TechnicianNotes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
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_MaintenanceRecords", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_MaintenanceRecords_AspNetUsers_PerformedById",
|
|
column: x => x.PerformedById,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
table.ForeignKey(
|
|
name: "FK_MaintenanceRecords_Equipment_EquipmentId",
|
|
column: x => x.EquipmentId,
|
|
principalTable: "Equipment",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Customers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
CompanyName = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
ContactFirstName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ContactLastName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Email = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
Phone = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
MobilePhone = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Address = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
City = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
State = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ZipCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Country = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsCommercial = table.Column<bool>(type: "bit", nullable: false),
|
|
TaxId = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
CreditLimit = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
CurrentBalance = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
PaymentTerms = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
PricingTierId = table.Column<int>(type: "int", nullable: true),
|
|
GeneralNotes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
|
LastContactDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
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_Customers", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Customers_PricingTiers_PricingTierId",
|
|
column: x => x.PricingTierId,
|
|
principalTable: "PricingTiers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "InventoryItems",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
SKU = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Category = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
ColorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ColorCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Finish = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Manufacturer = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ManufacturerPartNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
QuantityOnHand = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
UnitOfMeasure = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
ReorderPoint = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
ReorderQuantity = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
MinimumStock = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
MaximumStock = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
UnitCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
AverageCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
LastPurchasePrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
LastPurchaseDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
PrimarySupplierId = table.Column<int>(type: "int", nullable: true),
|
|
SupplierPartNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Location = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
IsActive = table.Column<bool>(type: "bit", nullable: false),
|
|
DiscontinuedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
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_InventoryItems", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_InventoryItems_Suppliers_PrimarySupplierId",
|
|
column: x => x.PrimarySupplierId,
|
|
principalTable: "Suppliers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "CustomerNotes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
CustomerId = table.Column<int>(type: "int", nullable: false),
|
|
Note = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
IsImportant = table.Column<bool>(type: "bit", 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_CustomerNotes", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_CustomerNotes_Customers_CustomerId",
|
|
column: x => x.CustomerId,
|
|
principalTable: "Customers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Quotes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
QuoteNumber = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
CustomerId = table.Column<int>(type: "int", nullable: false),
|
|
PreparedById = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
IsCommercial = table.Column<bool>(type: "bit", nullable: false),
|
|
QuoteDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
ExpirationDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
SentDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
ApprovedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
SubTotal = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
DiscountPercent = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
DiscountAmount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
TaxPercent = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
TaxAmount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
Total = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Terms = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
CustomerPO = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
AISuggestedPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
AIPriceRationale = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
UsedAISuggestion = table.Column<bool>(type: "bit", nullable: false),
|
|
ConvertedToJobId = table.Column<int>(type: "int", nullable: true),
|
|
ConvertedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
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_Quotes", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Quotes_AspNetUsers_PreparedById",
|
|
column: x => x.PreparedById,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
table.ForeignKey(
|
|
name: "FK_Quotes_Customers_CustomerId",
|
|
column: x => x.CustomerId,
|
|
principalTable: "Customers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "InventoryTransactions",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
InventoryItemId = table.Column<int>(type: "int", nullable: false),
|
|
TransactionType = table.Column<int>(type: "int", nullable: false),
|
|
Quantity = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
UnitCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
TotalCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
TransactionDate = 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),
|
|
BalanceAfter = table.Column<decimal>(type: "decimal(18,2)", 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_InventoryTransactions", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_InventoryTransactions_InventoryItems_InventoryItemId",
|
|
column: x => x.InventoryItemId,
|
|
principalTable: "InventoryItems",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Jobs",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
JobNumber = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
|
CustomerId = table.Column<int>(type: "int", nullable: false),
|
|
QuoteId = table.Column<int>(type: "int", nullable: true),
|
|
AssignedEmployeeId = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Status = table.Column<int>(type: "int", nullable: false),
|
|
Priority = table.Column<int>(type: "int", nullable: false),
|
|
ScheduledDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
StartedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
CompletedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
DueDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
EstimatedCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
ActualCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
QuotedPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
FinalPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
CustomerPO = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
SpecialInstructions = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
RequiresCustomerApproval = table.Column<bool>(type: "bit", nullable: false),
|
|
IsCustomerApproved = table.Column<bool>(type: "bit", nullable: false),
|
|
CustomerApprovedDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
|
EstimatedHours = table.Column<int>(type: "int", nullable: false),
|
|
ActualHours = 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_Jobs", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Jobs_AspNetUsers_AssignedEmployeeId",
|
|
column: x => x.AssignedEmployeeId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
table.ForeignKey(
|
|
name: "FK_Jobs_Customers_CustomerId",
|
|
column: x => x.CustomerId,
|
|
principalTable: "Customers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_Jobs_Quotes_QuoteId",
|
|
column: x => x.QuoteId,
|
|
principalTable: "Quotes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "QuoteItems",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
QuoteId = table.Column<int>(type: "int", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Quantity = table.Column<int>(type: "int", nullable: false),
|
|
ColorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ColorCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Finish = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Length = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
Width = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
Height = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
SurfaceArea = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
MeasurementUnit = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
TotalPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
RequiresSandblasting = table.Column<bool>(type: "bit", nullable: false),
|
|
RequiresMasking = table.Column<bool>(type: "bit", nullable: false),
|
|
EstimatedMinutes = table.Column<int>(type: "int", nullable: false),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
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_QuoteItems", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_QuoteItems_Quotes_QuoteId",
|
|
column: x => x.QuoteId,
|
|
principalTable: "Quotes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobItems",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
JobId = table.Column<int>(type: "int", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Quantity = table.Column<int>(type: "int", nullable: false),
|
|
PowderInventoryId = table.Column<int>(type: "int", nullable: true),
|
|
ColorName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
ColorCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Finish = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
Length = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
Width = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
Height = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
Weight = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
SurfaceArea = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
|
|
MeasurementUnit = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
TotalPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
MaterialCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
LaborCost = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
RequiresSandblasting = table.Column<bool>(type: "bit", nullable: false),
|
|
RequiresMasking = table.Column<bool>(type: "bit", nullable: false),
|
|
EstimatedMinutes = table.Column<int>(type: "int", nullable: false),
|
|
ActualMinutes = table.Column<int>(type: "int", nullable: false),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
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_JobItems", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_JobItems_InventoryItems_PowderInventoryId",
|
|
column: x => x.PowderInventoryId,
|
|
principalTable: "InventoryItems",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_JobItems_Jobs_JobId",
|
|
column: x => x.JobId,
|
|
principalTable: "Jobs",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobNotes",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
JobId = table.Column<int>(type: "int", nullable: false),
|
|
Note = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
IsImportant = table.Column<bool>(type: "bit", nullable: false),
|
|
IsInternal = table.Column<bool>(type: "bit", 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_JobNotes", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_JobNotes_Jobs_JobId",
|
|
column: x => x.JobId,
|
|
principalTable: "Jobs",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobPhotos",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
JobId = table.Column<int>(type: "int", nullable: false),
|
|
FileName = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
FilePath = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
PhotoType = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
PhotoDate = table.Column<DateTime>(type: "datetime2", 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_JobPhotos", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_JobPhotos_Jobs_JobId",
|
|
column: x => x.JobId,
|
|
principalTable: "Jobs",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "JobStatusHistory",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
JobId = table.Column<int>(type: "int", nullable: false),
|
|
FromStatus = table.Column<int>(type: "int", nullable: false),
|
|
ToStatus = table.Column<int>(type: "int", nullable: false),
|
|
ChangedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
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_JobStatusHistory", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_JobStatusHistory_Jobs_JobId",
|
|
column: x => x.JobId,
|
|
principalTable: "Jobs",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.InsertData(
|
|
table: "PricingTiers",
|
|
columns: new[] { "Id", "CreatedAt", "CreatedBy", "DeletedAt", "DeletedBy", "Description", "DiscountPercent", "IsActive", "IsDeleted", "TierName", "UpdatedAt", "UpdatedBy" },
|
|
values: new object[,]
|
|
{
|
|
{ 1, new DateTime(2026, 2, 5, 16, 37, 50, 175, DateTimeKind.Utc).AddTicks(1418), null, null, null, "Standard pricing for regular customers", 0m, true, false, "Standard", null, null },
|
|
{ 2, new DateTime(2026, 2, 5, 16, 37, 50, 175, DateTimeKind.Utc).AddTicks(1424), null, null, null, "5% discount for preferred customers", 5m, true, false, "Preferred", null, null },
|
|
{ 3, new DateTime(2026, 2, 5, 16, 37, 50, 175, DateTimeKind.Utc).AddTicks(1426), null, null, null, "10% discount for premium customers", 10m, true, false, "Premium", null, null }
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetRoleClaims_RoleId",
|
|
table: "AspNetRoleClaims",
|
|
column: "RoleId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "RoleNameIndex",
|
|
table: "AspNetRoles",
|
|
column: "NormalizedName",
|
|
unique: true,
|
|
filter: "[NormalizedName] IS NOT NULL");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetUserClaims_UserId",
|
|
table: "AspNetUserClaims",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetUserLogins_UserId",
|
|
table: "AspNetUserLogins",
|
|
column: "UserId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_AspNetUserRoles_RoleId",
|
|
table: "AspNetUserRoles",
|
|
column: "RoleId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "EmailIndex",
|
|
table: "AspNetUsers",
|
|
column: "NormalizedEmail");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "UserNameIndex",
|
|
table: "AspNetUsers",
|
|
column: "NormalizedUserName",
|
|
unique: true,
|
|
filter: "[NormalizedUserName] IS NOT NULL");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_CustomerNotes_CustomerId",
|
|
table: "CustomerNotes",
|
|
column: "CustomerId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Customers_CompanyName",
|
|
table: "Customers",
|
|
column: "CompanyName");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Customers_Email",
|
|
table: "Customers",
|
|
column: "Email",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Customers_PricingTierId",
|
|
table: "Customers",
|
|
column: "PricingTierId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_InventoryItems_PrimarySupplierId",
|
|
table: "InventoryItems",
|
|
column: "PrimarySupplierId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_InventoryItems_SKU",
|
|
table: "InventoryItems",
|
|
column: "SKU",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_InventoryTransactions_InventoryItemId",
|
|
table: "InventoryTransactions",
|
|
column: "InventoryItemId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobItems_JobId",
|
|
table: "JobItems",
|
|
column: "JobId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobItems_PowderInventoryId",
|
|
table: "JobItems",
|
|
column: "PowderInventoryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobNotes_JobId",
|
|
table: "JobNotes",
|
|
column: "JobId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobPhotos_JobId",
|
|
table: "JobPhotos",
|
|
column: "JobId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Jobs_AssignedEmployeeId",
|
|
table: "Jobs",
|
|
column: "AssignedEmployeeId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Jobs_CustomerId",
|
|
table: "Jobs",
|
|
column: "CustomerId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Jobs_JobNumber",
|
|
table: "Jobs",
|
|
column: "JobNumber",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Jobs_QuoteId",
|
|
table: "Jobs",
|
|
column: "QuoteId",
|
|
unique: true,
|
|
filter: "[QuoteId] IS NOT NULL");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_JobStatusHistory_JobId",
|
|
table: "JobStatusHistory",
|
|
column: "JobId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_MaintenanceRecords_EquipmentId",
|
|
table: "MaintenanceRecords",
|
|
column: "EquipmentId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_MaintenanceRecords_PerformedById",
|
|
table: "MaintenanceRecords",
|
|
column: "PerformedById");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_QuoteItems_QuoteId",
|
|
table: "QuoteItems",
|
|
column: "QuoteId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Quotes_CustomerId",
|
|
table: "Quotes",
|
|
column: "CustomerId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Quotes_PreparedById",
|
|
table: "Quotes",
|
|
column: "PreparedById");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Quotes_QuoteNumber",
|
|
table: "Quotes",
|
|
column: "QuoteNumber",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetRoleClaims");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserClaims");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserLogins");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserRoles");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUserTokens");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "CustomerNotes");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "InventoryTransactions");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobItems");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobNotes");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobPhotos");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "JobStatusHistory");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "MaintenanceRecords");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "QuoteItems");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetRoles");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "InventoryItems");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Jobs");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Equipment");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Suppliers");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Quotes");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "AspNetUsers");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Customers");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "PricingTiers");
|
|
}
|
|
}
|
|
}
|