Skip to content

Commit 5c29030

Browse files
committed
Enable RetryPolicy + SchemaDiff
1 parent 147993b commit 5c29030

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎MyApp/Configure.Db.cs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public void Configure(IWebHostBuilder builder) => builder
1616
?? "DataSource=App_Data/app.db;Cache=Shared";
1717

1818
services.AddOrmLite(options => options.UseSqlite(connectionString));
19+
// Retry deadlocks, throttling and lost connections on PostgreSQL, SQL Server and MySQL (SQLite isn't retried)
20+
OrmLiteConfig.RetryPolicy = OrmLiteRetry.Exponential(maxRetries: 3);
1921

2022
// $ dotnet ef migrations add CreateIdentitySchema
2123
// $ dotnet ef database update
@@ -25,6 +27,9 @@ public void Configure(IWebHostBuilder builder) => builder
2527
});
2628

2729
// Enable built-in Database Admin UI at /admin-ui/database
28-
services.AddPlugin(new AdminDatabaseFeature());
30+
services.AddPlugin(new AdminDatabaseFeature {
31+
// Log differences between data models and their tables on startup
32+
LogSchemaDiff = context.HostingEnvironment.IsDevelopment(),
33+
});
2934
});
3035
}

‎MyApp/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"build": "npm run ui:build",
99
"secret:prod": "gh secret set APPSETTINGS_JSON < appsettings.Production.json",
1010
"migrate": "dotnet run --AppTasks=migrate",
11+
"migrate:new": "dotnet run --AppTasks=migrate.new",
1112
"revert:last": "dotnet run --AppTasks=migrate.revert:last",
1213
"revert:all": "dotnet run --AppTasks=migrate.revert:all",
1314
"rerun:last": "npm run revert:last && npm run migrate",

0 commit comments

Comments
 (0)