Skip to content

Commit

Permalink
Update ApplicationDbInitializer.cs (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
xlogex authored Feb 25, 2022
1 parent ceccd54 commit e5c9b5b
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ public async Task InitializeAsync(CancellationToken cancellationToken)
{
if (_dbContext.Database.GetMigrations().Any())
{
if (_dbContext.Database.GetPendingMigrations().Any())
if ((await _dbContext.Database.GetPendingMigrationsAsync(cancellationToken)).Any())
{
_logger.LogInformation("Applying Migrations for '{tenantId}' tenant.", _currentTenant.Id);
await _dbContext.Database.MigrateAsync(cancellationToken);
}

if (_dbContext.Database.CanConnect())
if (await _dbContext.Database.CanConnectAsync(cancellationToken))
{
_logger.LogInformation("Connection to {tenantId}'s Database Succeeded.", _currentTenant.Id);

await _dbSeeder.SeedDatabaseAsync(_dbContext, cancellationToken);
}
}
}
}
}

0 comments on commit e5c9b5b

Please sign in to comment.