private void PrepareDatabase() { var ct = CancellationToken.None; using (var connection = new OracleConnection(ConnectionString)) using (var context = new MigratorTestContext(connection)) { var manager = new OracleMigrationManager <MigratorTestContext>( context, new DefaultNamingNormalizer <MigratorTestContext>(), LoggingManager.LoggerFactory); manager.PrepareDatabaseAsync(ct) .ConfigureAwait(false) .GetAwaiter() .GetResult(); string migrationId; string className; MigrationsTestHelper.GenerateMigrationInfo( DateTimeOffset.UtcNow, out migrationId, out className); // Existing static migration manager.AddMigrationAsync(migrationId, className, null, ct) .ConfigureAwait(false) .GetAwaiter() .GetResult(); } }
public async Task GivenAnEmptyDatabaseWhenPreparingForMigrationsThenATableMustBeCreated() { var ct = CancellationToken.None; var manager = new OracleMigrationManager<OracleMigratorTestContext>( _fixture.Context, LoggingManager.LoggerFactory); await manager.PrepareDatabaseAsync(ct); var tableId = await _fixture.Context.RunAsync(async () => await _fixture.Context.QuerySingleAsync<long>(@" SELECT COUNT(*) TOTAL FROM( SELECT -- making sure all columns exist CONTEXT_NAME, MIGRATION_ID, CLASS_NAME, DESCRIPTION, APPLIED_ON FROM MIGRATORTESTEMPTY.DB_MIGRATOR_HISTORY )", ct: ct), true, ct); Assert.Equal(0L, tableId); }
private void PrepareDatabase() { var ct = CancellationToken.None; using (var context = new OracleMigratorTestContext(Options)) { var manager = new OracleMigrationManager <OracleMigratorTestContext>(context, LoggingManager.LoggerFactory); manager.PrepareDatabaseAsync(ct) .ConfigureAwait(false) .GetAwaiter() .GetResult(); MigrationsTestHelper.GenerateMigrationInfo( DateTimeOffset.UtcNow, out var migrationId, out var className); // Existing static migration manager.AddMigrationAsync(migrationId, className, null, ct) .ConfigureAwait(false) .GetAwaiter() .GetResult(); } }