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( new AzureSqlDatabaseServiceObjective("standard", "S0", 500), 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 void AzureSqlDatabase_ReadModel_can_be_configured_using_a_migration() { var databaseSettings = Settings.Get <AzureSqlDatabaseSettings>(); databaseSettings.DatabaseName = "ItsCqrsMigrationsTestReadModels"; var connectionString = databaseSettings.BuildConnectionString(); using (var context = new MigrationsTestReadModels(connectionString, typeof(OrderTallyEntityModelConfiguration))) { new ReadModelDatabaseInitializer <MigrationsTestReadModels>().InitializeDatabase(context); var migrator = new AzureSqlDbMigrator( new AzureSqlDatabaseServiceObjective("Premium", "P1", 10 * 1024), migrationVersion: new Version("0.0.42.1")); context.EnsureDatabaseIsUpToDate(migrator); var sku = context.GetAzureSqlDatabaseServiceObjective(); sku.Edition.Should().Be("Premium"); sku.ServiceObjective.Should().Be("P1"); context.OpenConnection() .GetLatestAppliedMigrationVersions() .Should() .Contain(v => v.MigrationVersion.ToString() == "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"); } }