Ensures the migrations table is created on install, updates the installation to create the latest migration version once complete.
This commit is contained in:
@@ -542,7 +542,7 @@ namespace Umbraco.Core
|
||||
return _result;
|
||||
}
|
||||
|
||||
internal Result CreateDatabaseSchemaAndData()
|
||||
internal Result CreateDatabaseSchemaAndData(ApplicationContext applicationContext)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -584,7 +584,9 @@ namespace Umbraco.Core
|
||||
//If Configuration Status is empty and the determined version is "empty" its a new install - otherwise upgrade the existing
|
||||
if (string.IsNullOrEmpty(GlobalSettings.ConfigurationStatus) && installedVersion.Equals(new Version(0, 0, 0)))
|
||||
{
|
||||
database.CreateDatabaseSchema();
|
||||
var helper = new DatabaseSchemaHelper(database, _logger, SqlSyntax);
|
||||
helper.CreateDatabaseSchema(true, applicationContext);
|
||||
|
||||
message = message + "<p>Installation completed!</p>";
|
||||
|
||||
//now that everything is done, we need to determine the version of SQL server that is executing
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models.Rdbms;
|
||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
using Umbraco.Core.Persistence.Migrations.Initial;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core.Persistence
|
||||
{
|
||||
@@ -60,7 +62,7 @@ namespace Umbraco.Core.Persistence
|
||||
if (guardConfiguration && applicationContext.IsConfigured)
|
||||
throw new Exception("Umbraco is already configured!");
|
||||
|
||||
CreateDatabaseSchemaDo();
|
||||
CreateDatabaseSchemaDo(applicationContext.Services.MigrationEntryService);
|
||||
}
|
||||
|
||||
internal void CreateDatabaseSchemaDo(bool guardConfiguration, ApplicationContext applicationContext)
|
||||
@@ -68,16 +70,19 @@ namespace Umbraco.Core.Persistence
|
||||
if (guardConfiguration && applicationContext.IsConfigured)
|
||||
throw new Exception("Umbraco is already configured!");
|
||||
|
||||
CreateDatabaseSchemaDo();
|
||||
CreateDatabaseSchemaDo(applicationContext.Services.MigrationEntryService);
|
||||
}
|
||||
|
||||
internal void CreateDatabaseSchemaDo()
|
||||
internal void CreateDatabaseSchemaDo(IMigrationEntryService migrationEntryService)
|
||||
{
|
||||
_logger.Info<Database>("Initializing database schema creation");
|
||||
|
||||
var creation = new DatabaseSchemaCreation(_db, _logger, _syntaxProvider);
|
||||
creation.InitializeDatabaseSchema();
|
||||
|
||||
//Now ensure to cretae the tag in the db for the current migration version
|
||||
migrationEntryService.CreateEntry(GlobalSettings.UmbracoMigrationName, UmbracoVersion.Current);
|
||||
|
||||
_logger.Info<Database>("Finalized database schema creation");
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,8 @@ namespace Umbraco.Core.Persistence.Migrations.Initial
|
||||
{41, typeof (AccessDto)},
|
||||
{42, typeof (AccessRuleDto)},
|
||||
{43, typeof(CacheInstructionDto)},
|
||||
{44, typeof (ExternalLoginDto)}
|
||||
{44, typeof (ExternalLoginDto)},
|
||||
{45, typeof (MigrationDto)}
|
||||
};
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
|
||||
public override InstallSetupResult Execute(object model)
|
||||
{
|
||||
var result = _applicationContext.DatabaseContext.CreateDatabaseSchemaAndData();
|
||||
var result = _applicationContext.DatabaseContext.CreateDatabaseSchemaAndData(_applicationContext);
|
||||
|
||||
if (result.Success == false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user