Skip to content

Commit d199452

Browse files
committed
Always apply migration instead of checking status
1 parent c58a6c7 commit d199452

File tree

1 file changed

+1
-18
lines changed

1 file changed

+1
-18
lines changed

src/MaintenanceLog/DatabaseUtility.cs

+1-18
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,7 @@ public static async Task EnsureDbCreatedAndSeedWithDefaults(DbContextOptions<App
2323
try
2424
{
2525
// not good with distributed UI... but for now...
26-
27-
var migrations = await context.Database.GetPendingMigrationsAsync();
28-
foreach (var migration in migrations)
29-
{
30-
// Execute all migrations in one single transaction
31-
using var tran = await context.Database.BeginTransactionAsync();
32-
try
33-
{
34-
Console.WriteLine($"Applying migration '{migration}'...");
35-
await migrator.MigrateAsync(migration);
36-
await tran.CommitAsync();
37-
}
38-
catch (Exception exc)
39-
{
40-
await tran.RollbackAsync();
41-
throw new Exception($"Error while applying db migration '{migration}'.", exc);
42-
}
43-
}
26+
await context.Database.MigrateAsync();
4427
}
4528
catch (Exception ex)
4629
{

0 commit comments

Comments
 (0)