New: DB-Migration / Repositories und Models für den Premiumbereich
This commit is contained in:
90
Server/Migrations/01000002_AddReportAndFileColumns.cs
Normal file
90
Server/Migrations/01000002_AddReportAndFileColumns.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user