Creation of EF Core Migrations - these execute using EF Tools, but are not integrated to run programmatically
This commit is contained in:
29
Oqtane.Server/Migrations/01000201_DropColumnFromPage.cs
Normal file
29
Oqtane.Server/Migrations/01000201_DropColumnFromPage.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Oqtane.Migrations.EntityBuilders;
|
||||
using Oqtane.Repository;
|
||||
|
||||
namespace Oqtane.Migrations
|
||||
{
|
||||
[DbContext(typeof(TenantDBContext))]
|
||||
[Migration("Tenant.01.00.02.01")]
|
||||
public class DropColumnFromPage : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
//Drop Column from Page table
|
||||
if (migrationBuilder.ActiveProvider != "Microsoft.EntityFrameworkCore.Sqlite")
|
||||
{
|
||||
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder);
|
||||
pageEntityBuilder.DropColumn("EditMode");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
//Add Column to Page table
|
||||
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder);
|
||||
pageEntityBuilder.AddBooleanColumn("EditMode");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user