using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace PowderCoating.Infrastructure.Migrations { /// public partial class AddRecurringTemplates : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_VendorCreditApplications_Bills_BillId", table: "VendorCreditApplications"); migrationBuilder.DropForeignKey( name: "FK_VendorCreditApplications_VendorCredits_VendorCreditId", table: "VendorCreditApplications"); migrationBuilder.AddColumn( name: "VendorCreditId1", table: "VendorCreditApplications", type: "int", nullable: true); migrationBuilder.CreateTable( name: "RecurringTemplates", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(type: "nvarchar(max)", nullable: false), TemplateType = table.Column(type: "int", nullable: false), Frequency = table.Column(type: "int", nullable: false), IntervalCount = table.Column(type: "int", nullable: false), NextFireDate = table.Column(type: "datetime2", nullable: false), EndDate = table.Column(type: "datetime2", nullable: true), MaxOccurrences = table.Column(type: "int", nullable: true), OccurrenceCount = table.Column(type: "int", nullable: false), IsActive = table.Column(type: "bit", nullable: false), TemplateData = table.Column(type: "nvarchar(max)", nullable: false), LastError = table.Column(type: "nvarchar(max)", nullable: true), CompanyId = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), UpdatedAt = table.Column(type: "datetime2", nullable: true), CreatedBy = table.Column(type: "nvarchar(max)", nullable: true), UpdatedBy = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: false), DeletedAt = table.Column(type: "datetime2", nullable: true), DeletedBy = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { table.PrimaryKey("PK_RecurringTemplates", x => x.Id); }); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 5, 10, 15, 1, 54, 769, DateTimeKind.Utc).AddTicks(6262)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 5, 10, 15, 1, 54, 769, DateTimeKind.Utc).AddTicks(6270)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 5, 10, 15, 1, 54, 769, DateTimeKind.Utc).AddTicks(6271)); migrationBuilder.CreateIndex( name: "IX_VendorCreditApplications_VendorCreditId1", table: "VendorCreditApplications", column: "VendorCreditId1"); migrationBuilder.AddForeignKey( name: "FK_VendorCreditApplications_Bills_BillId", table: "VendorCreditApplications", column: "BillId", principalTable: "Bills", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_VendorCreditApplications_VendorCredits_VendorCreditId", table: "VendorCreditApplications", column: "VendorCreditId", principalTable: "VendorCredits", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_VendorCreditApplications_VendorCredits_VendorCreditId1", table: "VendorCreditApplications", column: "VendorCreditId1", principalTable: "VendorCredits", principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_VendorCreditApplications_Bills_BillId", table: "VendorCreditApplications"); migrationBuilder.DropForeignKey( name: "FK_VendorCreditApplications_VendorCredits_VendorCreditId", table: "VendorCreditApplications"); migrationBuilder.DropForeignKey( name: "FK_VendorCreditApplications_VendorCredits_VendorCreditId1", table: "VendorCreditApplications"); migrationBuilder.DropTable( name: "RecurringTemplates"); migrationBuilder.DropIndex( name: "IX_VendorCreditApplications_VendorCreditId1", table: "VendorCreditApplications"); migrationBuilder.DropColumn( name: "VendorCreditId1", table: "VendorCreditApplications"); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 1, column: "CreatedAt", value: new DateTime(2026, 5, 10, 14, 48, 51, 545, DateTimeKind.Utc).AddTicks(3903)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 2, column: "CreatedAt", value: new DateTime(2026, 5, 10, 14, 48, 51, 545, DateTimeKind.Utc).AddTicks(3909)); migrationBuilder.UpdateData( table: "PricingTiers", keyColumn: "Id", keyValue: 3, column: "CreatedAt", value: new DateTime(2026, 5, 10, 14, 48, 51, 545, DateTimeKind.Utc).AddTicks(3910)); migrationBuilder.AddForeignKey( name: "FK_VendorCreditApplications_Bills_BillId", table: "VendorCreditApplications", column: "BillId", principalTable: "Bills", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_VendorCreditApplications_VendorCredits_VendorCreditId", table: "VendorCreditApplications", column: "VendorCreditId", principalTable: "VendorCredits", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }