public void When_used_with_a_non_Azure_SQL_database_then_AzureSqlDbMigrator_is_applied_but_does_nothing() { // arrange Database.Delete(MigrationsTestReadModels.ConnectionString); using (var context = new MigrationsTestReadModels()) { new CreateAndMigrate<MigrationsTestReadModels>().InitializeDatabase(context); var migrator = new AzureSqlDbMigrator( serviceObjective: "S0", edition: "standard", maxSize: "500 MB", migrationVersion: new Version("0.1.2.3")); // act context.EnsureDatabaseIsUpToDate(migrator); // assert var latestAppliedMigrationVersions = context.OpenConnection() .GetLatestAppliedMigrationVersions(); latestAppliedMigrationVersions .Should() .Contain(v => v.MigrationVersion.ToString() == "0.1.2.3"); } }
public async Task AzureSqlDatabase_can_be_configured_using_a_migration() { var databaseSettings = Settings.Get<AzureSqlDatabaseSettings>(); databaseSettings.DatabaseName = "ItsCqrsMigrationsTest"; var connectionString = databaseSettings.BuildConnectionString(); using (var context = new EventStoreDbContext(connectionString)) { new EventStoreDatabaseInitializer<EventStoreDbContext>().InitializeDatabase(context); var migrator = new AzureSqlDbMigrator( "S0", "10 GB", new Version("0.0.42.1")); context.EnsureDatabaseIsUpToDate(migrator); context.OpenConnection() .GetAppliedMigrationVersions() .Should() .Contain("0.0.42.1"); } }
public void AzureSqlDatabase_EventStore_can_be_configured_using_a_migration() { var databaseSettings = Settings.Get<AzureSqlDatabaseSettings>(); databaseSettings.DatabaseName = "ItsCqrsMigrationsTestEventStore"; var connectionString = databaseSettings.BuildConnectionString(); using (var context = new EventStoreDbContext(connectionString)) { new EventStoreDatabaseInitializer<EventStoreDbContext>().InitializeDatabase(context); var migrator = new AzureSqlDbMigrator( serviceObjective: "S0", edition: "standard", maxSize: "500 MB", migrationVersion: new Version("0.0.42.1")); context.EnsureDatabaseIsUpToDate(migrator); context.OpenConnection() .GetLatestAppliedMigrationVersions() .Should() .Contain(v => v.MigrationVersion.ToString() == "0.0.42.1"); } }