Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        private void InternalCreateEmptyHistoryTables()
        {
            EnsureSchemaCreated();
            var builder = HistoryTablesBuilder.Get();

            builder.Execute(ConnectionString, TimeoutSecs);
        }
Ejemplo n.º 3
0
        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);
        }