public override void Process(DeleteSchemaExpression expression) { this.ExecuteCodeBlockUntilNoExeception(() => { if (!SchemaExists(expression.SchemaName)) { return; } var stopwatch = new StopWatch(); Logger.LogSay($"Dropping Postgres schema '{expression.SchemaName}'..."); stopwatch.Time(() => Process(ExtendedGeneratorField.Generate(expression))); Logger.LogSay($"Dropped Postgres schema '{expression.SchemaName}'..."); Logger.LogElapsedTime(stopwatch.ElapsedTime()); Process(new DeleteUserExpression(expression)); PostgresDatabaseCreator.DropDatabase( DbMigrationConfig, () => { stopwatch.Start(); Logger.LogSay($"Dropping Postgres database '{DbMigrationConfig.DatabaseName.ToLower()}'..."); }, sql => { stopwatch.Stop(); Logger.LogSql(sql); Logger.LogSay($"Dropped Postgres database '{DbMigrationConfig.DatabaseName.ToLower()}'..."); Logger.LogElapsedTime(stopwatch.ElapsedTime()); }); }, ex => Logger.LogError(ex, $"Dropping Postgres schema(user) '{expression.SchemaName}' failed with exception :-(")); }
public ExtendedPostgresProcessor(IDbMigrationConfig dbMigrationConfig, PostgresQuoter quoter, PostgresDbFactory factory, PostgresGenerator generator, ILogger <ExtendedPostgresProcessor> logger, IOptionsSnapshot <ProcessorOptions> options, IConnectionStringAccessor connectionStringAccessor, IExtendedMigrationGenerator <ExtendedPostgresGenerator> extendedGenerator) : base(factory, generator, logger, options, connectionStringAccessor) { ExtendedGeneratorField = extendedGenerator; DbMigrationConfig = dbMigrationConfig; if (dbMigrationConfig.ProcessorId == ProcessorIds.PostgresProcessorId) { var stopWatch = new StopWatch(); PostgresDatabaseCreator.CreateDatabase( dbMigrationConfig, () => { Logger.LogSay($"Creating Postgres database '{dbMigrationConfig.DatabaseName.ToLower()}'..."); stopWatch.Start(); }, sql => { stopWatch.Stop(); Logger.LogSql(sql); Logger.LogSay($"Created Postgres database '{dbMigrationConfig.DatabaseName.ToLower()}'..."); Logger.LogElapsedTime(stopWatch.ElapsedTime()); }); } this.SetPrivateFieldValue <PostgresProcessor>("_quoter", quoter); }
public override void Process(DeleteSchemaExpression expression) { this.ExecuteCodeBlockUntilNoExeception(() => { if (!SchemaExists(expression.SchemaName)) { return; } Logger.LogSay($"Dropping Postgres schema(user) '{expression.SchemaName}'..."); Process(ExtendedGeneratorField.Generate(expression)); Logger.LogSay($"Dropped Postgres schema(user) '{expression.SchemaName}'..."); Process(new DeleteUserExpression(expression)); PostgresDatabaseCreator.DropDatabase(DbConfig); }, ex => Logger.LogError(ex, $"Dropping Postgres schema(user) '{expression.SchemaName}' failed with exception :-(")); }
public ExtendedPostgresProcessor( IDbConfig dbConfig, PostgresQuoter quoter, PostgresDbFactory factory, PostgresGenerator generator, ILogger <ExtendedPostgresProcessor> logger, IOptionsSnapshot <ProcessorOptions> options, IConnectionStringAccessor connectionStringAccessor, IExtendedMigrationGenerator <ExtendedPostgresGenerator> extendedGenerator) : base(factory, generator, logger, options, connectionStringAccessor) { ExtendedGeneratorField = extendedGenerator; DbConfig = dbConfig; if (dbConfig.DbType.GetProcessorId() == ProcessorIds.PostgresProcessorId) { PostgresDatabaseCreator.CreateDatabase(dbConfig); } this.SetPrivateFieldValue <PostgresProcessor>("_quoter", quoter); }