Commit 22a3309 1 parent 4a24e53 commit 22a3309 Copy full SHA for 22a3309
File tree 1 file changed +15
-7
lines changed
1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change 1
- using MaintenanceLog . Data ;
1
+ using MaintenanceLog . Data ;
2
2
using Microsoft . EntityFrameworkCore ;
3
3
4
4
namespace MaintenanceLog ;
@@ -17,11 +17,19 @@ public static async Task EnsureDbCreatedAndSeedWithDefaults(DbContextOptions<App
17
17
{
18
18
Console . WriteLine ( "Database already exists or was not otherwise created." ) ;
19
19
}
20
- // if ((await context.Database.GetPendingMigrationsAsync()).Any())
21
- // {
22
- // // not good with distributed UI... but for now...
23
- // Console.WriteLine("Applying migrations...");
24
- // await context.Database.MigrateAsync();
25
- // }
20
+
21
+ try
22
+ {
23
+ if ( ( await context . Database . GetPendingMigrationsAsync ( ) ) . Any ( ) )
24
+ {
25
+ // not good with distributed UI... but for now...
26
+ Console . WriteLine ( "Applying migrations..." ) ;
27
+ await context . Database . MigrateAsync ( ) ;
28
+ }
29
+ }
30
+ catch ( Exception ex )
31
+ {
32
+ Console . WriteLine ( $ "Error applying migrations: { ex . Message } ") ;
33
+ }
26
34
}
27
35
}
You can’t perform that action at this time.
0 commit comments