Add support for Sqlite - Installation path tested but AddSite not supported yet

This commit is contained in:
Charles Nurse
2021-03-23 11:06:18 -07:00
parent 8f1c760e87
commit cbcfc88492
22 changed files with 227 additions and 116 deletions

View File

@ -21,6 +21,12 @@ namespace Oqtane.Migrations
pageEntityBuilder.Create();
pageEntityBuilder.AddIndex("IX_Page", new [] {"SiteId", "Path", "UserId"}, true);
//Add Column to Page table (for Sql Server only) we will drop it later for Sql Server only
if (migrationBuilder.ActiveProvider == "Microsoft.EntityFrameworkCore.SqlServer")
{
pageEntityBuilder.AddBooleanColumn("EditMode");
}
//Create Module table
var moduleEntityBuilder = new ModuleEntityBuilder(migrationBuilder);
moduleEntityBuilder.Create();

View File

@ -12,7 +12,7 @@ namespace Oqtane.Migrations
protected override void Up(MigrationBuilder migrationBuilder)
{
//Drop Column from Page table
if (migrationBuilder.ActiveProvider != "Microsoft.EntityFrameworkCore.Sqlite")
if (migrationBuilder.ActiveProvider == "Microsoft.EntityFrameworkCore.SqlServer")
{
var pageEntityBuilder = new PageEntityBuilder(migrationBuilder);
pageEntityBuilder.DropColumn("EditMode");

View File

@ -0,0 +1,27 @@
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Oqtane.Migrations.EntityBuilders;
using Oqtane.Repository;
namespace Oqtane.Migrations
{
[DbContext(typeof(MasterDBContext))]
[Migration("Master.02.01.00.01")]
public class AddDatabaseTypeColumnToTenant : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
//Add Column to Site table
var tenantEntityBuilder = new TenantEntityBuilder(migrationBuilder);
tenantEntityBuilder.AddStringColumn("DBType", 200, true);
//Update new column
migrationBuilder.Sql(
@"
UPDATE Tenant
SET DBType = 'SqlServer'
");
}
}
}

View File

@ -35,7 +35,6 @@ namespace Oqtane.Migrations.EntityBuilders
IsNavigation = table.AddBooleanColumn("IsNavigation");
Url = table.AddStringColumn("Url", 500, true);
LayoutType = table.AddStringColumn("LayoutType", 200);
EditMode = table.AddBooleanColumn("EditMode");
UserId = table.AddIntegerColumn("UserId", true);
IsPersonalizable = table.AddBooleanColumn("IsPersonalizable");
DefaultContainerType = table.AddStringColumn("DefaultContainerType", 200, true);
@ -69,8 +68,6 @@ namespace Oqtane.Migrations.EntityBuilders
public OperationBuilder<AddColumnOperation> LayoutType { get; private set; }
public OperationBuilder<AddColumnOperation> EditMode { get; private set; }
public OperationBuilder<AddColumnOperation> UserId { get; private set; }
public OperationBuilder<AddColumnOperation> IsPersonalizable { get; private set; }