Recover empty Care demo tenants after onboarding races.
Deploy Ladill Care / deploy (push) Successful in 54s
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:
@@ -34,7 +34,12 @@ return new class extends Migration
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['organization_id', 'branch_id', 'is_active']);
|
||||
// Short name: MySQL's 64-char limit rejects the auto-generated
|
||||
// care_facility_workflows_organization_id_branch_id_is_active_index.
|
||||
$table->index(
|
||||
['organization_id', 'branch_id', 'is_active'],
|
||||
'care_fw_org_branch_active_idx',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Repair indexes skipped when an earlier deploy created care_facility_workflows
|
||||
* then failed on the too-long auto-generated composite index name.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('care_facility_workflows')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$indexes = collect(Schema::getIndexes('care_facility_workflows'))
|
||||
->mapWithKeys(fn (array $index) => [($index['name'] ?? '') => $index]);
|
||||
|
||||
Schema::table('care_facility_workflows', function (Blueprint $table) use ($indexes) {
|
||||
if (! $indexes->has('care_facility_workflows_uuid_unique')) {
|
||||
$table->unique('uuid', 'care_facility_workflows_uuid_unique');
|
||||
}
|
||||
|
||||
if (! $indexes->has('care_facility_workflows_owner_ref_index')) {
|
||||
$table->index('owner_ref', 'care_facility_workflows_owner_ref_index');
|
||||
}
|
||||
|
||||
if (! $indexes->has('care_fw_org_branch_active_idx')
|
||||
&& ! $indexes->has('care_facility_workflows_organization_id_branch_id_is_active_index')) {
|
||||
$table->index(
|
||||
['organization_id', 'branch_id', 'is_active'],
|
||||
'care_fw_org_branch_active_idx',
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('care_facility_workflows')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$indexes = collect(Schema::getIndexes('care_facility_workflows'))
|
||||
->mapWithKeys(fn (array $index) => [($index['name'] ?? '') => $index]);
|
||||
|
||||
Schema::table('care_facility_workflows', function (Blueprint $table) use ($indexes) {
|
||||
if ($indexes->has('care_fw_org_branch_active_idx')) {
|
||||
$table->dropIndex('care_fw_org_branch_active_idx');
|
||||
}
|
||||
if ($indexes->has('care_facility_workflows_owner_ref_index')) {
|
||||
$table->dropIndex('care_facility_workflows_owner_ref_index');
|
||||
}
|
||||
if ($indexes->has('care_facility_workflows_uuid_unique')) {
|
||||
$table->dropUnique('care_facility_workflows_uuid_unique');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user