jonsequitur / Its.Cqrs

A set of libraries for CQRS and Event Sourcing, with a Domain-Driven Design flavor.
Other
77 stars 21 forks source link

Create and Migrate to SQL Azure Database SKU #194

Closed xavierjohn closed 7 years ago

xavierjohn commented 7 years ago

Create and Migrate to SQL Azure Database SKU

xavierjohn commented 7 years ago

There are multiple reasons why drop DB may fail... you may need to use a command scheduler to really get the job done.

Sent from my iPhone

On Jan 4, 2017, at 8:43 AM, Jon Sequeira notifications@github.com<mailto:notifications@github.com> wrote:

@jonsequitur commented on this pull request.


In Domain.Sql.Tests/AzureDatabaseConfigurationTests.cshttps://github.com/jonsequitur/Its.Cqrs/pull/194#pullrequestreview-15148333:

  • var connectionString = databaseSettings.BuildConnectionString();
  • var sqlAzureDatabaseProperties = new AzureSqlDatabaseServiceObjective("Premium", "P1", 10 * 1024);
  • using (var context = new MigrationsTestReadModels(connectionString, typeof(OrderTallyEntityModelConfiguration)))
  • {
  • new ReadModelDatabaseInitializer()
  • .WithSqlAzureDatabaseProperties(sqlAzureDatabaseProperties)
  • .InitializeDatabase(context);
  • var sku = context.GetAzureDatabaseProperties();
  • sku.Edition.Should().Be("Premium");
  • sku.ServiceObjective.Should().Be("P1");
  • // Drop the expensive database
  • context.Database.Connection.Close();

The database won't be dropped if the test fails before this point.

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/jonsequitur/Its.Cqrs/pull/194#pullrequestreview-15148333, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABxgfrXQwwNVHan1Wi3udjuPq1UuozbZks5rO8w_gaJpZM4LX9Yn.

jonsequitur commented 7 years ago

I'm not trying to prevent the database deletion failing, just pointing out that if the assertion fails, we'll never even reach the line of code that deletes the database.

On Wed, Jan 4, 2017 at 8:50 AM, Xavier notifications@github.com wrote:

There are multiple reasons why drop DB may fail... you may need to use a command scheduler to really get the job done.

Sent from my iPhone

On Jan 4, 2017, at 8:43 AM, Jon Sequeira <notifications@github.com<mailto: notifications@github.com>> wrote:

@jonsequitur commented on this pull request.


In Domain.Sql.Tests/AzureDatabaseConfigurationTests.cshttps://github.com/ jonsequitur/Its.Cqrs/pull/194#pullrequestreview-15148333:

  • var connectionString = databaseSettings.BuildConnectionString();
  • var sqlAzureDatabaseProperties = new AzureSqlDatabaseServiceObjective("Premium", "P1", 10 * 1024);
  • using (var context = new MigrationsTestReadModels(connectionString, typeof(OrderTallyEntityModelConfiguration)))
  • {
  • new ReadModelDatabaseInitializer()
  • .WithSqlAzureDatabaseProperties(sqlAzureDatabaseProperties)
  • .InitializeDatabase(context);
  • var sku = context.GetAzureDatabaseProperties();
  • sku.Edition.Should().Be("Premium");
  • sku.ServiceObjective.Should().Be("P1");
  • // Drop the expensive database
  • context.Database.Connection.Close();

The database won't be dropped if the test fails before this point.

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ jonsequitur/Its.Cqrs/pull/194#pullrequestreview-15148333, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ ABxgfrXQwwNVHan1Wi3udjuPq1UuozbZks5rO8w_gaJpZM4LX9Yn.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jonsequitur/Its.Cqrs/pull/194#issuecomment-270421492, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhaVxEPS21Ne5uq8X07iU2ELiA4lP6Aks5rO83ugaJpZM4LX9Yn .

xavierjohn commented 7 years ago

Internal

Sent from my iPhone

On Jan 4, 2017, at 10:57 AM, Jon Sequeira notifications@github.com<mailto:notifications@github.com> wrote:

@jonsequitur commented on this pull request.


In Domain.Sql/Migrations/Migrator.cshttps://github.com/jonsequitur/Its.Cqrs/pull/194#pullrequestreview-15174073:

@@ -75,6 +75,25 @@ internal static bool CurrentUserHasWritePermissions(this TContext cont return (result ?? 1) == 1; }

What's the significance of "Int" in the name?

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/jonsequitur/Its.Cqrs/pull/194#pullrequestreview-15174073, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABxgfvBJLn9kdQcugqTMx7mnMEceWZ3Vks5rO-t-gaJpZM4LX9Yn.