public static void EnsureExist(string connectionString, int timeoutSecs) { _log.DebugFormat("Checking existence of history tables in schema: {0}", HistorySchema.HistorySchemaName); if (!DatabaseUtils.SchemaExists(connectionString, timeoutSecs, HistorySchema.HistorySchemaName)) { DatabaseUtils.CreateSchema(connectionString, timeoutSecs, HistorySchema.HistorySchemaName); } var b = HistoryTablesBuilder.Get(); var tables = b.GetTables(); var tablesInHistorySchema = DatabaseUtils.GetTablesInSchema( connectionString, timeoutSecs, false, HistorySchema.HistorySchemaName); var builder = new Builder(); foreach (var t in tables) { if (!tablesInHistorySchema.Contains(t.Name)) { builder.AddTable(t); } } if (builder.HasTables) { _log.WarnFormat("Recreating missing history tables in schema: {0}", HistorySchema.HistorySchemaName); builder.Execute(connectionString, timeoutSecs); } }
private void InternalCreateEmptyHistoryTables() { EnsureSchemaCreated(); var builder = HistoryTablesBuilder.Get(); builder.Execute(ConnectionString, TimeoutSecs); }
public TimeSpan PerformDiff(Dictionary <string, PrimaryKeyInfo> pkInfo, long logId) { var stopwatch = Stopwatch.StartNew(); _log.DebugFormat("Performing full diff on stage: {0}", DatabaseUtils.GetConnectionDescription(ConnectionString)); var b = HistoryTablesBuilder.Get(); DoParallelProcessing(b, pkInfo, logId); return(stopwatch.Elapsed); }