예제 #1
0
        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");
        }
예제 #2
0
 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;
 }
예제 #3
0
        /// <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;
        }