shoc-backend/Data.SeaHavenIndustries/Migrations/20260818150533_SH249_TradesVocabulary.cs

65 lines
2.7 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Data.SeaHavenIndustries.Migrations
{
/// <inheritdoc />
public partial class SH249_TradesVocabulary : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Trades",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
NormalizedName = table.Column<string>(type: "nvarchar(128)", maxLength: 128, nullable: false),
SortOrder = table.Column<int>(type: "int", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Trades", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Trades_NormalizedName",
table: "Trades",
column: "NormalizedName",
unique: true);
// SH-249 canonical trade vocabulary. PROVISIONAL: sourced from the
// in-repo prototype seed in Program.cs; Product must confirm before
// release. Keep literals in sync with TradeCatalog.CanonicalTrades
// (tests assert the applied table matches the catalog). Extend the
// vocabulary after this ships only through new migrations.
migrationBuilder.InsertData(
table: "Trades",
columns: new[] { "Id", "Name", "NormalizedName", "SortOrder", "IsActive" },
values: new object[,]
{
{ 1, "Plumbing", "plumbing", 1, true },
{ 2, "Electrical", "electrical", 2, true },
{ 3, "HVAC", "hvac", 3, true },
{ 4, "Fire/Life Safety", "fire/life safety", 4, true },
{ 5, "General", "general", 5, true },
{ 6, "Roofing", "roofing", 6, true },
{ 7, "Janitorial", "janitorial", 7, true },
{ 8, "Painting", "painting", 8, true },
{ 9, "Locksmith", "locksmith", 9, true },
{ 10, "Carpentry", "carpentry", 10, true }
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Trades");
}
}
}