[backend/startup] Exit with error if database has pending migrations
This commit is contained in:
parent
faee1e01dc
commit
23e7630ca6
1 changed files with 5 additions and 1 deletions
|
@ -64,6 +64,10 @@ public static class WebApplicationExtensions {
|
|||
context.Database.Migrate();
|
||||
if (args.Contains("--migrate")) Environment.Exit(0);
|
||||
}
|
||||
else if (context.Database.GetPendingMigrations().Any()) {
|
||||
app.Logger.LogCritical("Database has pending migrations, please restart with --migrate or --migrate-and-start");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
app.Logger.LogInformation("Verifying redis connection...");
|
||||
var cache = provider.ServiceProvider.GetService<IDistributedCache>();
|
||||
|
|
Loading…
Add table
Reference in a new issue