diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs index a4cde086c..dfbd4b373 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs @@ -108,21 +108,17 @@ namespace Orchard.Setup.Services { var shellBlueprint = _compositionStrategy.Compose(shellSettings, shellDescriptor); // initialize database explicitly, and store shell descriptor - using (var bootstrapLifetimeScope = _shellContainerFactory.CreateContainer(shellSettings, shellBlueprint)) - { + using (var bootstrapLifetimeScope = _shellContainerFactory.CreateContainer(shellSettings, shellBlueprint)) { - using (var environment = bootstrapLifetimeScope.CreateWorkContextScope()) - { + using (var environment = bootstrapLifetimeScope.CreateWorkContextScope()) { // check if the database is already created (in case an exception occured in the second phase) - var shellDescriptorRepository = environment.Resolve>(); - try - { - shellDescriptorRepository.Get(x => true); + var schemaBuilder = new SchemaBuilder(environment.Resolve()); + try { + var tablePrefix = String.IsNullOrEmpty(_shellSettings.DataTablePrefix) ? "" : _shellSettings.DataTablePrefix + "_"; + schemaBuilder.ExecuteSql("SELECT * FROM " + tablePrefix + "Settings_ShellDescriptorRecord"); } - catch - { - var schemaBuilder = new SchemaBuilder(environment.Resolve()); + catch { var reportsCoordinator = environment.Resolve(); reportsCoordinator.Register("Data Migration", "Setup", "Orchard installation"); @@ -136,8 +132,7 @@ namespace Orchard.Setup.Services { var dataMigrationManager = environment.Resolve(); dataMigrationManager.Update("Settings"); - foreach (var feature in context.EnabledFeatures) - { + foreach (var feature in context.EnabledFeatures) { dataMigrationManager.Update(feature); } diff --git a/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs b/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs index 3fba6211a..63378fd62 100644 --- a/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs +++ b/src/Orchard/Data/Migration/Interpreters/DefaultDataMigrationInterpreter.cs @@ -339,17 +339,20 @@ namespace Orchard.Data.Migration.Interpreters { var session = _sessionLocator.For(typeof(ContentItemRecord)); var connection = session.Connection; - foreach (var sqlStatement in _sqlStatements) { - Logger.Debug(sqlStatement); - using (var command = connection.CreateCommand()) { - command.CommandText = sqlStatement; - command.ExecuteNonQuery(); + try { + foreach (var sqlStatement in _sqlStatements) { + Logger.Debug(sqlStatement); + using (var command = connection.CreateCommand()) { + command.CommandText = sqlStatement; + command.ExecuteNonQuery(); + } + + _reportsCoordinator.Information("Data Migration", String.Format("Executing SQL Query: {0}", sqlStatement)); } - - _reportsCoordinator.Information("Data Migration", String.Format("Executing SQL Query: {0}", sqlStatement)); } - - _sqlStatements.Clear(); + finally { + _sqlStatements.Clear(); + } } private bool ExecuteCustomInterpreter(T command) where T : ISchemaBuilderCommand { diff --git a/src/Orchard/Environment/ShellBuilders/ShellContextFactory.cs b/src/Orchard/Environment/ShellBuilders/ShellContextFactory.cs index a3a51107e..7df34f2fe 100644 --- a/src/Orchard/Environment/ShellBuilders/ShellContextFactory.cs +++ b/src/Orchard/Environment/ShellBuilders/ShellContextFactory.cs @@ -96,7 +96,7 @@ namespace Orchard.Environment.ShellBuilders { } public ShellContext CreateSetupContext(ShellSettings settings) { - Logger.Warning("No shell settings available. Creating shell context for setup"); + Logger.Debug("No shell settings available. Creating shell context for setup"); var descriptor = new ShellDescriptor { SerialNumber = -1,