* This moves around files and deletes the temp projects with files that are not moved to Core, Infrastructure etc. Also moves the from new backoffice to static access, and override those with the old views in the legacy executeable * Removes old files from the new executeable. * Added missing files * Added EF Core project to solution file * fix build
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using Umbraco.Cms.Core;
|
|
using Umbraco.Cms.Core.Install;
|
|
using Umbraco.Cms.Core.Installer;
|
|
using Umbraco.Cms.Core.Models.Installer;
|
|
using Umbraco.Cms.Core.Services;
|
|
using Umbraco.Cms.Infrastructure.Migrations.Install;
|
|
|
|
namespace Umbraco.Cms.Infrastructure.Installer.Steps;
|
|
|
|
public class DatabaseInstallStep : IInstallStep, IUpgradeStep
|
|
{
|
|
private readonly IRuntimeState _runtime;
|
|
private readonly DatabaseBuilder _databaseBuilder;
|
|
|
|
public DatabaseInstallStep(IRuntimeState runtime, DatabaseBuilder databaseBuilder)
|
|
{
|
|
_runtime = runtime;
|
|
_databaseBuilder = databaseBuilder;
|
|
}
|
|
|
|
public Task ExecuteAsync(InstallData _) => Execute();
|
|
|
|
public Task ExecuteAsync() => Execute();
|
|
|
|
private Task Execute()
|
|
{
|
|
|
|
if (_runtime.Reason == RuntimeLevelReason.InstallMissingDatabase)
|
|
{
|
|
_databaseBuilder.CreateDatabase();
|
|
}
|
|
|
|
DatabaseBuilder.Result? result = _databaseBuilder.CreateSchemaAndData();
|
|
|
|
if (result?.Success == false)
|
|
{
|
|
throw new InstallException("The database failed to install. ERROR: " + result.Message);
|
|
}
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public Task<bool> RequiresExecutionAsync(InstallData _) => ShouldExecute();
|
|
|
|
public Task<bool> RequiresExecutionAsync() => ShouldExecute();
|
|
|
|
private Task<bool> ShouldExecute()
|
|
=> Task.FromResult(true);
|
|
}
|