private void RebuildDatabase() { // migration var schema = new DatabaseSchemaCreation(Database); // drop all the tables schema.UninstallDatabaseSchema(); // install the schema schema.InitializeDatabaseSchema(); // add the default data var baseDataCreation = new BaseDataCreation(Database); baseDataCreation.InitializeBaseData("merchDBTypeField"); baseDataCreation.InitializeBaseData("merchInvoiceStatus"); baseDataCreation.InitializeBaseData("merchOrderStatus"); baseDataCreation.InitializeBaseData("merchWarehouse"); baseDataCreation.InitializeBaseData("merchGatewayProviderSettings"); baseDataCreation.InitializeBaseData("merchStoreSetting"); }
private bool CreateInitialMerchelloData(BaseDataCreation baseDataCreation) { baseDataCreation.InitializeBaseData("merchDBTypeField"); baseDataCreation.InitializeBaseData("merchInvoiceStatus"); baseDataCreation.InitializeBaseData("merchOrderStatus"); baseDataCreation.InitializeBaseData("merchWarehouse"); baseDataCreation.InitializeBaseData("merchGatewayProvider"); baseDataCreation.InitializeBaseData("merchStoreSetting"); return true; }
/// <summary> /// Ensures the Merchello database has been installed. /// </summary> /// <returns> /// The <see cref="bool"/>. /// </returns> internal bool EnsureDatabase() { var databaseSchemaCreation = new DatabaseSchemaCreation(_database, _logger, new DatabaseSchemaHelper(_database, _logger, _sqlSyntaxProvider), _sqlSyntaxProvider); var schemaResult = databaseSchemaCreation.ValidateSchema(); var databaseVersion = schemaResult.DetermineInstalledVersion(); if (databaseVersion != new Version("0.0.0")) return true; // install the database var schemaHelper = new MerchelloDatabaseSchemaHelper(this._database, this._logger, this._sqlSyntaxProvider); schemaHelper.CreateDatabaseSchema(); var baseDataCreation = new BaseDataCreation(this._database, this._logger); baseDataCreation.InitializeBaseData("merchTypeField"); baseDataCreation.InitializeBaseData("merchInvoiceStatus"); baseDataCreation.InitializeBaseData("merchOrderStatus"); baseDataCreation.InitializeBaseData("merchWarehouse"); baseDataCreation.InitializeBaseData("merchGatewayProviderSettings"); baseDataCreation.InitializeBaseData("merchStoreSetting"); baseDataCreation.InitializeBaseData("merchShipmentStatus"); return false; }