Added suuport to inject an IOqtaneDatabase in EntityBuilders to allow each Database to control certain Migration behaviors. Also updated Installer to dynamically build Database Configuration section
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Oqtane.Interfaces;
|
||||
using Oqtane.Migrations.EntityBuilders;
|
||||
using Oqtane.Repository;
|
||||
|
||||
@ -7,14 +9,18 @@ namespace Oqtane.Migrations
|
||||
{
|
||||
[DbContext(typeof(TenantDBContext))]
|
||||
[Migration("Tenant.01.00.02.01")]
|
||||
public class DropColumnFromPage : Migration
|
||||
public class DropColumnFromPage : MultiDatabaseMigration
|
||||
{
|
||||
public DropColumnFromPage(IEnumerable<IOqtaneDatabase> databases) : base(databases)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
//Drop Column from Page table
|
||||
if (migrationBuilder.ActiveProvider == "Microsoft.EntityFrameworkCore.SqlServer")
|
||||
if (ActiveDatabase.Name == "SqlServer" || ActiveDatabase.Name == "LocalDB")
|
||||
{
|
||||
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder);
|
||||
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||
pageEntityBuilder.DropColumn("EditMode");
|
||||
}
|
||||
}
|
||||
@ -22,7 +28,7 @@ namespace Oqtane.Migrations
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
//Add Column to Page table
|
||||
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder);
|
||||
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||
pageEntityBuilder.AddBooleanColumn("EditMode");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user