using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Oqtane.Databases.Interfaces; using Oqtane.Migrations; using SZUAbsolventenverein.Module.PremiumArea.Migrations.EntityBuilders; using SZUAbsolventenverein.Module.PremiumArea.Repository; using System; namespace SZUAbsolventenverein.Module.PremiumArea.Migrations { [DbContext(typeof(PremiumAreaContext))] [Migration("SZUAbsolventenverein.Module.PremiumArea.01.00.00.02")] public class AddReportAndFileColumns : MultiDatabaseMigration { public AddReportAndFileColumns(IDatabase database) : base(database) { } protected override void Up(MigrationBuilder migrationBuilder) { // Add FileId (nullable int) - assuming missing migrationBuilder.AddColumn( name: "FileId", table: "SZUAbsolventenvereinEngineerApplications", nullable: true); // Add PdfFileName (string 256) migrationBuilder.AddColumn( name: "PdfFileName", table: "SZUAbsolventenvereinEngineerApplications", maxLength: 256, nullable: true); // Add ApprovedOn (DateTime nullable) - might exist but adding if missing? // MigrationBuilder will fail if exists. We assume schema drift needs this. // If it exists, user must handle. migrationBuilder.AddColumn( name: "ApprovedOn", table: "SZUAbsolventenvereinEngineerApplications", nullable: true); // Add IsReported (bool not null default false) migrationBuilder.AddColumn( name: "IsReported", table: "SZUAbsolventenvereinEngineerApplications", nullable: false, defaultValue: false); // Add ReportReason (string max nullable) migrationBuilder.AddColumn( name: "ReportReason", table: "SZUAbsolventenvereinEngineerApplications", nullable: true); // Add ReportCount (int not null default 0) migrationBuilder.AddColumn( name: "ReportCount", table: "SZUAbsolventenvereinEngineerApplications", nullable: false, defaultValue: 0); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "IsReported", table: "SZUAbsolventenvereinEngineerApplications"); migrationBuilder.DropColumn( name: "ReportReason", table: "SZUAbsolventenvereinEngineerApplications"); migrationBuilder.DropColumn( name: "ReportCount", table: "SZUAbsolventenvereinEngineerApplications"); migrationBuilder.DropColumn( name: "FileId", table: "SZUAbsolventenvereinEngineerApplications"); migrationBuilder.DropColumn( name: "PdfFileName", table: "SZUAbsolventenvereinEngineerApplications"); migrationBuilder.DropColumn( name: "ApprovedOn", table: "SZUAbsolventenvereinEngineerApplications"); } } }