Example #1
0
 public static void ChangeTable(string tableName, Action<Migrator> configMigration, MigrationOptions options = null)
 {
     try
     {
         var origin = Table.Parse(tableName, Connection);
         var invoker = new Invoker(origin, Connection);
         configMigration.Invoke(invoker.Migrator);
         invoker.Run(options);
     }
     catch (Exception ex)
     {
         Logger.ErrorException(ex.Message, ex);
     }
     finally
     {
         Connection.Close();
     }
 }
Example #2
0
        private MigrationOptions ConfigureOptions(MigrationOptions options)
        {
            if (options == null)
            {
                options = new MigrationOptions();
            }

            if (options.Throttler == null)
            {
                if (Lhm.Throttler != null)
                {
                    options.Throttler = Lhm.Throttler;
                }

                //use the default throttler todo create throttler factory
                options.Throttler = new TimeThrottler(10, 100);
            }

            return options;
        }
Example #3
0
        public void Run(MigrationOptions options)
        {
            Logger.Info("Starting LHM run on table " + _migrator.Name);

            options = ConfigureOptions(options);

            var migration = Migrator.Run();

            var entangler = new Entangler(migration, _connection);
            entangler.Run();

            var chunker = new Chunker(migration, _connection, options);
            chunker.Run();

            if (options.UseAtomicSwitcher)
            {
                var switcher = new AtomicSwitcher(migration, _connection);
                switcher.Run();
            }
            else
            {
                //todo create alternate switcher
            }
        }
Example #4
0
 public Chunker(TableMigration migration, IDbConnection connection, MigrationOptions options)
 {
     _migration = migration;
     _connection = connection;
     _throttler = options.Throttler;
 }