Add دندانپزشک + پرستار سالمندان roles (idempotent ensure on startup)
CI/CD / CI · dotnet build (push) Successful in 2m11s
CI/CD / Deploy · hamkadr (push) Has been cancelled

Roles were only seeded on a fresh DB, so existing deployments never got
new ones. Introduced a canonical role list + EnsureRolesAsync that runs on
every startup and inserts any missing role — so production picks up the two
new roles without a manual step. Original 7 keep their order/ids; the two
new roles are appended (sort 8-9).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-08 09:27:34 +03:30
parent fb02c81830
commit 70c048a37b
2 changed files with 33 additions and 9 deletions
+2 -1
View File
@@ -94,7 +94,8 @@ using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
db.Database.Migrate();
await SeedData.SeedReferenceAsync(db); // cities/roles/districts always
await SeedData.SeedReferenceAsync(db); // cities/districts on first run
await SeedData.EnsureRolesAsync(db); // add any missing roles (idempotent, existing DBs too)
// Demo board in Development, or whenever the admin has turned Demo Mode on.
var st = await scope.ServiceProvider
.GetRequiredService<JobsMedical.Web.Services.Scraping.SettingsService>().GetAsync();