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

@ -0,0 +1,42 @@
using System;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Oqtane.Enums;
using Oqtane.Models;
using Oqtane.Modules.HtmlText.Repository;
using Oqtane.Repository;
namespace Oqtane.Modules
{
public class MigratableModuleBase
{
public bool Migrate(DBContextBase dbContext, Tenant tenant, MigrationType migrationType)
{
var result = true;
using (dbContext)
{
try
{
var migrator = dbContext.GetService<IMigrator>();
if (migrationType == MigrationType.Down)
{
migrator.Migrate(Migration.InitialDatabase);
}
else
{
migrator.Migrate();
}
}
catch (Exception e)
{
Console.WriteLine(e);
result = false;
}
}
return result;
}
}
}