using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PowderCoating.Infrastructure.Migrations { /// public partial class MigrateShopWorkerToUserAssignment : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Appointments_ShopWorkers_AssignedWorkerId", table: "Appointments"); migrationBuilder.DropForeignKey( name: "FK_Jobs_ShopWorkers_AssignedWorkerId", table: "Jobs"); migrationBuilder.DropForeignKey( name: "FK_MaintenanceRecords_ShopWorkers_AssignedWorkerId", table: "MaintenanceRecords"); migrationBuilder.DropIndex( name: "IX_Appointments_AssignedWorkerId", table: "Appointments"); migrationBuilder.DropColumn( name: "AssignedWorkerId", table: "Appointments"); migrationBuilder.RenameColumn( name: "AssignedWorkerId", table: "MaintenanceRecords", newName: "ShopWorkerId"); migrationBuilder.RenameIndex( name: "IX_MaintenanceRecords_AssignedWorkerId", table: "MaintenanceRecords", newName: "IX_MaintenanceRecords_ShopWorkerId"); migrationBuilder.RenameColumn( name: "AssignedWorkerId", table: "Jobs", newName: "ShopWorkerId"); migrationBuilder.RenameIndex( name: "IX_Jobs_AssignedWorkerId", table: "Jobs", newName: "IX_Jobs_ShopWorkerId"); migrationBuilder.AddColumn( name: "AssignedUserId", table: "MaintenanceRecords", type: "nvarchar(450)", nullable: true); migrationBuilder.AddColumn( name: "AssignedUserId", table: "Jobs", type: "nvarchar(450)", nullable: true); migrationBuilder.AddColumn( name: "AssignedUserId", table: "Appointments", type: "nvarchar(450)", nullable: true); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 3, 13, 20, 31, 2, 381, DateTimeKind.Utc).AddTicks(3596)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 3, 13, 20, 31, 2, 381, DateTimeKind.Utc).AddTicks(3602)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 3, 13, 20, 31, 2, 381, DateTimeKind.Utc).AddTicks(3603)); migrationBuilder.CreateIndex( name: "IX_MaintenanceRecords_AssignedUserId", table: "MaintenanceRecords", column: "AssignedUserId"); migrationBuilder.CreateIndex( name: "IX_Jobs_AssignedUserId", table: "Jobs", column: "AssignedUserId"); migrationBuilder.CreateIndex( name: "IX_Appointments_AssignedUserId", table: "Appointments", column: "AssignedUserId"); migrationBuilder.AddForeignKey( name: "FK_Appointments_AspNetUsers_AssignedUserId", table: "Appointments", column: "AssignedUserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.NoAction); migrationBuilder.AddForeignKey( name: "FK_Jobs_AspNetUsers_AssignedUserId", table: "Jobs", column: "AssignedUserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.NoAction); migrationBuilder.AddForeignKey( name: "FK_Jobs_ShopWorkers_ShopWorkerId", table: "Jobs", column: "ShopWorkerId", principalTable: "ShopWorkers", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_MaintenanceRecords_AspNetUsers_AssignedUserId", table: "MaintenanceRecords", column: "AssignedUserId", principalTable: "AspNetUsers", principalColumn: "Id", onDelete: ReferentialAction.NoAction); migrationBuilder.AddForeignKey( name: "FK_MaintenanceRecords_ShopWorkers_ShopWorkerId", table: "MaintenanceRecords", column: "ShopWorkerId", principalTable: "ShopWorkers", principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Appointments_AspNetUsers_AssignedUserId", table: "Appointments"); migrationBuilder.DropForeignKey( name: "FK_Jobs_AspNetUsers_AssignedUserId", table: "Jobs"); migrationBuilder.DropForeignKey( name: "FK_Jobs_ShopWorkers_ShopWorkerId", table: "Jobs"); migrationBuilder.DropForeignKey( name: "FK_MaintenanceRecords_AspNetUsers_AssignedUserId", table: "MaintenanceRecords"); migrationBuilder.DropForeignKey( name: "FK_MaintenanceRecords_ShopWorkers_ShopWorkerId", table: "MaintenanceRecords"); migrationBuilder.DropIndex( name: "IX_MaintenanceRecords_AssignedUserId", table: "MaintenanceRecords"); migrationBuilder.DropIndex( name: "IX_Jobs_AssignedUserId", table: "Jobs"); migrationBuilder.DropIndex( name: "IX_Appointments_AssignedUserId", table: "Appointments"); migrationBuilder.DropColumn( name: "AssignedUserId", table: "MaintenanceRecords"); migrationBuilder.DropColumn( name: "AssignedUserId", table: "Jobs"); migrationBuilder.DropColumn( name: "AssignedUserId", table: "Appointments"); migrationBuilder.RenameColumn( name: "ShopWorkerId", table: "MaintenanceRecords", newName: "AssignedWorkerId"); migrationBuilder.RenameIndex( name: "IX_MaintenanceRecords_ShopWorkerId", table: "MaintenanceRecords", newName: "IX_MaintenanceRecords_AssignedWorkerId"); migrationBuilder.RenameColumn( name: "ShopWorkerId", table: "Jobs", newName: "AssignedWorkerId"); migrationBuilder.RenameIndex( name: "IX_Jobs_ShopWorkerId", table: "Jobs", newName: "IX_Jobs_AssignedWorkerId"); migrationBuilder.AddColumn( name: "AssignedWorkerId", table: "Appointments", type: "int", nullable: true); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 3, 13, 18, 27, 53, 492, DateTimeKind.Utc).AddTicks(2001)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 3, 13, 18, 27, 53, 492, DateTimeKind.Utc).AddTicks(2009)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 3, 13, 18, 27, 53, 492, DateTimeKind.Utc).AddTicks(2011)); migrationBuilder.CreateIndex( name: "IX_Appointments_AssignedWorkerId", table: "Appointments", column: "AssignedWorkerId"); migrationBuilder.AddForeignKey( name: "FK_Appointments_ShopWorkers_AssignedWorkerId", table: "Appointments", column: "AssignedWorkerId", principalTable: "ShopWorkers", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_Jobs_ShopWorkers_AssignedWorkerId", table: "Jobs", column: "AssignedWorkerId", principalTable: "ShopWorkers", principalColumn: "Id", onDelete: ReferentialAction.SetNull); migrationBuilder.AddForeignKey( name: "FK_MaintenanceRecords_ShopWorkers_AssignedWorkerId", table: "MaintenanceRecords", column: "AssignedWorkerId", principalTable: "ShopWorkers", principalColumn: "Id", onDelete: ReferentialAction.SetNull); } } }