public void CreateProcessorWithNoProviderSwitchesShouldUseOracleQuoter(string providerSwitches) { _options.ProviderSwitches = providerSwitches; var processor = _factory.Create(_connectionString, _announcer, _options); Assert.That(((OracleProcessor)processor).Quoter, Is.InstanceOf <OracleQuoter>()); }
private MigrationRunner CreateRunner(MigrationDb db, out StringBuilder output) { var sb = output = new StringBuilder(); var announcer = new TextWriterAnnouncer(s => { if (sb.Length == 0) { sb.AppendLine(); } sb.Append(s); }); IMigrationProcessorFactory factory = CreateFactory(db.DatabaseServer); IMigrationProcessor processor = factory.Create(db.ConnectionString, announcer, new MigrationOptions(db)); var context = new RunnerContext(announcer) { Namespace = db.NamespaceContainingMigrations, ApplicationContext = _kernel }; return(new MigrationRunner(db.Assembly, context, processor)); }
private static MigrationRunner GetRunner(string connectionString, IMigrationProcessorFactory factory) { var announcer = new NullAnnouncer(); var assembly = Assembly.GetExecutingAssembly(); var migrationContext = new RunnerContext(announcer) { Namespace = "Migrations" }; var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 }; var processor = factory.Create(connectionString, announcer, options); return new MigrationRunner(assembly, migrationContext, processor); }
private static MigrationRunner GetRunner(string connectionString, IMigrationProcessorFactory factory) { var announcer = new NullAnnouncer(); var assembly = Assembly.GetExecutingAssembly(); var migrationContext = new RunnerContext(announcer) { Namespace = "Migrations" }; var options = new MigrationOptions { PreviewOnly = false, Timeout = 60 }; var processor = factory.Create(connectionString, announcer, options); return(new MigrationRunner(assembly, migrationContext, processor)); }
public void Migrate() { IAnnouncer announcer = new ServiceStackLoggingAnnouncer(_logFactory) { ShowSql = true }; IMigrationProcessorFactory migrationProcessorFactory = GetMigrationProcessorFactory(_configuration["DB_TYPE"]); ProcessorOptions options = new ProcessorOptions { PreviewOnly = false, // set to true to see the SQL Timeout = 60 }; using (IMigrationProcessor processor = migrationProcessorFactory.Create(_configuration["CONNECTION_STRING"], announcer, options)) { MigrationRunner runner = new MigrationRunner(GetType().Assembly, new RunnerContext(announcer), processor); runner.MigrateUp(); } }