private Result CreateSchemaAndData(IScope scope) { try { var readyForInstall = CheckReadyForInstall(); if (readyForInstall.Success == false) { return(readyForInstall.Result); } _logger.Info <DatabaseBuilder>("Database configuration status: Started"); var database = scope.Database; // If MySQL, we're going to ensure that database calls are maintaining proper casing as to remove the necessity for checks // for case insensitive queries. In an ideal situation (which is what we're striving for), all calls would be case sensitive. var message = database.DatabaseType.IsMySql() ? ResultMessageForMySql : ""; var schemaResult = ValidateSchema(); var hasInstalledVersion = schemaResult.DetermineHasInstalledVersion(); //var installedSchemaVersion = schemaResult.DetermineInstalledVersion(); //var hasInstalledVersion = !installedSchemaVersion.Equals(new Version(0, 0, 0)); //If Configuration Status is empty and the determined version is "empty" its a new install - otherwise upgrade the existing if (string.IsNullOrEmpty(_globalSettings.ConfigurationStatus) && !hasInstalledVersion) { if (_runtime.Level == RuntimeLevel.Run) { throw new Exception("Umbraco is already configured!"); } var creator = new DatabaseSchemaCreator(database, _logger); creator.InitializeDatabaseSchema(); message = message + "<p>Installation completed!</p>"; //now that everything is done, we need to determine the version of SQL server that is executing _logger.Info <DatabaseBuilder>("Database configuration status: {DbConfigStatus}", message); return(new Result { Message = message, Success = true, Percentage = "100" }); } //we need to do an upgrade so return a new status message and it will need to be done during the next step _logger.Info <DatabaseBuilder>("Database requires upgrade"); message = "<p>Upgrading database, this may take some time...</p>"; return(new Result { RequiresUpgrade = true, Message = message, Success = true, Percentage = "30" }); } catch (Exception ex) { return(HandleInstallException(ex)); } }
private Result CreateSchemaAndData(IScope scope) { try { var readyForInstall = CheckReadyForInstall(); if (readyForInstall.Success == false) { return(readyForInstall.Result); } _logger.Info <DatabaseBuilder>("Database configuration status: Started"); var database = scope.Database; var message = string.Empty; var schemaResult = ValidateSchema(); var hasInstalledVersion = schemaResult.DetermineHasInstalledVersion(); //If the determined version is "empty" its a new install - otherwise upgrade the existing if (!hasInstalledVersion) { if (_runtime.Level == RuntimeLevel.Run) { throw new Exception("Umbraco is already configured!"); } var creator = new DatabaseSchemaCreator(database, _logger); creator.InitializeDatabaseSchema(); message = message + "<p>Installation completed!</p>"; //now that everything is done, we need to determine the version of SQL server that is executing _logger.Info <DatabaseBuilder>("Database configuration status: {DbConfigStatus}", message); return(new Result { Message = message, Success = true, Percentage = "100" }); } //we need to do an upgrade so return a new status message and it will need to be done during the next step _logger.Info <DatabaseBuilder>("Database requires upgrade"); message = "<p>Upgrading database, this may take some time...</p>"; return(new Result { RequiresUpgrade = true, Message = message, Success = true, Percentage = "30" }); } catch (Exception ex) { return(HandleInstallException(ex)); } }