Database Manager

done:
+ master.sql as resource
+ implemented incremental database changes also for Master
+ dbUp sql script variables implemented
+ improved database handling and creation code
+ simpified database creation
+ almost all Database and Tenant creation moved to DatabaseManager.cs (rest code marked with TODO)
+ Unattended install of master can be performed by settings in appsettings.json
+ Improved IsInstalled checking
+ Removed DBSchema field from Tenant
+ Default database and site creation moved to Program.Main
This commit is contained in:
Pavel Vesely
2020-03-25 15:30:16 +01:00
parent 744782df7a
commit 940cdcb349
26 changed files with 726 additions and 525 deletions

View File

@ -4,6 +4,8 @@ using Microsoft.Extensions.Hosting;
using Microsoft.AspNetCore.Blazor.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.AspNetCore;
using Microsoft.Extensions.DependencyInjection;
using Oqtane.Infrastructure;
namespace Oqtane.Server
{
@ -12,7 +14,14 @@ namespace Oqtane.Server
#if DEBUG || RELEASE
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
var host = CreateHostBuilder(args).Build();
using (var serviceScope = host.Services.GetRequiredService<IServiceScopeFactory>().CreateScope())
{
var manager = serviceScope.ServiceProvider.GetService<DatabaseManager>();
manager.StartupMigration();
}
//DatabaseManager.StartupMigration();
host.Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>