Exemple #1
0
        protected int ExecuteMigrations(MigratorOptions options, IConsole console)
        {
            var serviceProvider = Setup.BuildServiceProvider(options, console);
            var executor        = serviceProvider.GetRequiredService <TaskExecutor>();

            executor.Execute();
            return(0);
        }
Exemple #2
0
 public DbMigrator(MigratorOptions options)
 {
     var provider = ProviderFactory.Create(options.Provider, options.ConnectionString);
     _migrationLoader = new MigrationLoader(provider, options.MigrationTypes, false);
     _migrationLoader.CheckForDuplicatedVersion();
     _provider = provider;
     Logger = new Logger(false, new ConsoleWriter());
     _options = options;
     provider.Writer = _options.Commands;
 }
        private int OnExecute(IConsole console)
        {
            var migratorOptions = new MigratorOptions();
            var serviceProvider = Setup.BuildServiceProvider(migratorOptions, console);
            var processors      = serviceProvider.GetRequiredService <IEnumerable <IMigrationProcessor> >().ToList();
            var processorIds    = processors.Select(p => p.DatabaseType).OrderBy(x => x);

            foreach (var processorType in processorIds)
            {
                console.WriteLine(processorType);
            }

            return(0);
        }
Exemple #4
0
        private int OnExecute(IConsole console)
        {
            var options = MigratorOptions.CreateRollbackBy(Parent, Steps);

            return(ExecuteMigrations(options, console));
        }
Exemple #5
0
        private int OnExecute(IConsole console)
        {
            var options = MigratorOptions.CreateMigrateUp(Parent, TargetVersion);

            return(ExecuteMigrations(options, console));
        }
 private int OnExecute(IConsole console)
 {
     var options = MigratorOptions.CreateRollbackTo(this);
     return ExecuteMigrations(options, console);
 }
Exemple #7
0
        private int OnExecute(IConsole console)
        {
            var options = MigratorOptions.CreateMigrateUp(this);

            return(ExecuteMigrations(options, console));
        }
Exemple #8
0
        private int OnExecute(IConsole console)
        {
            var options = MigratorOptions.CreateRollbackBy(this, null);

            return(ExecuteMigrations(options, console));
        }
        private int OnExecute(IConsole console)
        {
            var options = MigratorOptions.CreateValidateVersionOrder(this);

            return(ExecuteMigrations(options, console));
        }
Exemple #10
0
 public Migrator(string provider, string cs, Action <MigratorOptions> optionsFactory)
 {
     options = new MigratorOptions(provider, cs);
     optionsFactory(options);
     options = options.FromAssembly(this.GetType().Assembly);
 }