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 void Migrate(long? version) { Action<string> action = null; var builder = new StringBuilder(); if (FilePath != null || DryRun) action = x=>builder.AppendLine(x); var config = Simply.Do.GetConfig<ApplicationConfig>(); var options = new MigratorOptions(config.ADOProvider, Simply.Do.GetConnectionString()) .FromAssembly(typeof(DataLists).Assembly) .WithSchemaTable(config.SchemaInfoTable) .WriteWith(action); new DbMigrator(options).Migrate(version); if (FilePath != null) File.WriteAllText(FilePath, builder.ToString()); }
public Migrator(string provider, string cs, Action<MigratorOptions> optionsFactory) { options = new MigratorOptions(provider, cs); optionsFactory(options); options = options.FromAssembly(this.GetType().Assembly); }