91 lines
3.4 KiB
C#
91 lines
3.4 KiB
C#
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<int>(
|
|
name: "FileId",
|
|
table: "SZUAbsolventenvereinEngineerApplications",
|
|
nullable: true);
|
|
|
|
// Add PdfFileName (string 256)
|
|
migrationBuilder.AddColumn<string>(
|
|
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<DateTime>(
|
|
name: "ApprovedOn",
|
|
table: "SZUAbsolventenvereinEngineerApplications",
|
|
nullable: true);
|
|
|
|
// Add IsReported (bool not null default false)
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "IsReported",
|
|
table: "SZUAbsolventenvereinEngineerApplications",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
// Add ReportReason (string max nullable)
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ReportReason",
|
|
table: "SZUAbsolventenvereinEngineerApplications",
|
|
nullable: true);
|
|
|
|
// Add ReportCount (int not null default 0)
|
|
migrationBuilder.AddColumn<int>(
|
|
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");
|
|
}
|
|
}
|
|
}
|