Recover empty Care demo tenants after onboarding races.
Deploy Ladill Care / deploy (push) Successful in 54s

Demo Pro was left as an empty workflow shell after lock-timeout races; clear leftover rollout flags on seed, sync-reseed empty tenants on login, and repair missing facility workflow indexes.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-07-17 21:38:21 +00:00
co-authored by Cursor
parent e172d3c5d1
commit c461430441
7 changed files with 247 additions and 55 deletions
+11 -1
View File
@@ -386,9 +386,11 @@ class DemoTenantSeeder
->where('owner_ref', $ownerRef)
->first();
$facilityType = $plan === 'enterprise' ? 'hospital' : 'clinic';
$settings = array_merge($organization?->settings ?? [], [
'onboarded' => true,
'facility_type' => $plan === 'enterprise' ? 'hospital' : 'clinic',
'facility_type' => $facilityType,
'facility_category' => $facilityType,
'plan' => $plan,
'plan_expires_at' => now()->addYear()->toIso8601String(),
'billed_branches' => max(1, $billedBranches),
@@ -398,7 +400,15 @@ class DemoTenantSeeder
'specialty_modules' => in_array($plan, ['pro', 'enterprise'], true)
? ['dentistry' => true]
: [],
// Demo seed uses the legacy clinical path. Explicitly clear leftover
// onboarding rollout so a failed race that created a real workflow
// shell cannot leave an empty gated tenant.
'rollout' => [
CareFeatures::WORKFLOW_ENGINE => false,
CareFeatures::FINANCIAL_GATES => false,
],
]);
unset($settings['workflow_template']);
if ($organization) {
if ($organization->trashed()) {