Example #1
0
        public MigrateTask(Lazy <IDbFactory> db, IIntegrationDatabaseConfiguration configuration, IKernel kernel, IMigrationDbs dbs, IFeatureToggler featureToggler)
        {
            _kernel         = kernel;
            _featureToggler = featureToggler;

            if (!configuration.Disabled)
            {
                string connectionString = EnsureIntegrationDb(db.Value, configuration.CheckExistsAndCreateDatabaseIfNotFound, out _databaseCreated);

                var integrationDb = new IntegrationMigrationDb(
                    configuration.DatabaseServer,
                    ConnectionString.FromText(connectionString),
                    typeof(M1_Baseline).Assembly,
                    typeof(M1_Baseline).Namespace);

                MigrationRunner runner = CreateRunner(integrationDb, out _);

                long latestVersion = runner.VersionLoader.VersionInfo.Latest();
                _disabledFeatures = DisableFeatures(latestVersion);

                dbs = dbs.WithIntegrationDb(integrationDb);
            }

            _dbs = dbs.ToArray();
        }
Example #2
0
        public MigrateTask(Func <Vertica.Integration.Infrastructure.Database.IDbFactory> db, ILogger logger, IKernel kernel, IMigrationDbs dbs, ITaskFactory taskFactory, ITaskRunner taskRunner)
        {
            StringBuilder stringBuilder;

            this._kernel      = kernel;
            this._taskFactory = taskFactory;
            this._taskRunner  = taskRunner;
            if (!dbs.IntegrationDbDisabled)
            {
                string str = MigrateTask.EnsureIntegrationDb(db(), dbs.CheckExistsAndCreateIntegrationDbIfNotFound, out this._databaseCreated);
                IntegrationMigrationDb integrationMigrationDb = new IntegrationMigrationDb(dbs.IntegrationDbDatabaseServer, ConnectionString.FromText(str), typeof(M1_Baseline).Assembly, typeof(M1_Baseline).Namespace);
                if (!this.CreateRunner(integrationMigrationDb, out stringBuilder).VersionLoader.VersionInfo.HasAppliedMigration(MigrateTask.FindLatestMigration()))
                {
                    this._loggingDisabler = logger.Disable();
                }
                dbs = dbs.WithIntegrationDb(integrationMigrationDb);
            }
            this._dbs = dbs.ToArray <MigrationDb>();
        }