diff --git a/src/Umbraco.Core/Persistence/PetaPocoExtensions.cs b/src/Umbraco.Core/Persistence/PetaPocoExtensions.cs index f249ca4577..7ae81aaa16 100644 --- a/src/Umbraco.Core/Persistence/PetaPocoExtensions.cs +++ b/src/Umbraco.Core/Persistence/PetaPocoExtensions.cs @@ -304,22 +304,40 @@ namespace Umbraco.Core.Persistence return SqlSyntaxContext.SqlSyntaxProvider.DoesTableExist(db, tableName); } + /// + /// Creates the Umbraco db schema in the Database of the current Database. + /// Safe method that is only able to create the schema in non-configured + /// umbraco instances. + /// + /// Current PetaPoco object public static void CreateDatabaseSchema(this Database db) { CreateDatabaseSchema(db, true); } + /// + /// Creates the Umbraco db schema in the Database of the current Database + /// with the option to guard the db from having the schema created + /// multiple times. + /// + /// + /// + public static void CreateDatabaseSchema(this Database db, bool guardConfiguration) + { + if (guardConfiguration && ApplicationContext.Current.IsConfigured) + throw new Exception("Umbraco is already configured!"); + + CreateDatabaseSchemaDo(db); + } + internal static void UninstallDatabaseSchema(this Database db) { var creation = new DatabaseSchemaCreation(db); creation.UninstallDatabaseSchema(); } - internal static void CreateDatabaseSchema(this Database db, bool guardConfiguration) + internal static void CreateDatabaseSchemaDo(this Database db) { - if (guardConfiguration && ApplicationContext.Current.IsConfigured) - throw new Exception("Umbraco is already configured!"); - NewTable += PetaPocoExtensions_NewTable; LogHelper.Info("Initializing database schema creation");