Fix index check migration for SQLite compatibility
API CI/CD / Validate (composer + pint) (push) Successful in 2m7s
API CI/CD / Test (PHPUnit) (push) Failing after 2m22s
API CI/CD / Build frontend assets (push) Successful in 2m26s
API CI/CD / Security audit (push) Successful in 32s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped

This commit is contained in:
root
2026-06-21 13:51:54 -04:00
parent 588b40d0fa
commit 34c560e972
3 changed files with 142 additions and 4 deletions
@@ -18,13 +18,13 @@ return new class extends Migration
}
});
// Add index if it doesn't exist (SQLite-compatible check)
$schema = DB::connection()->getDoctrineSchemaManager();
$indexes = $schema->listTableIndexes('purchase_order_items');
if (! isset($indexes['po_items_inventory_item_idx'])) {
// Add index if it doesn't exist (SQLite-compatible)
try {
Schema::table('purchase_order_items', function (Blueprint $table) {
$table->index('inventory_item_id', 'po_items_inventory_item_idx');
});
} catch (\Exception $e) {
// Index likely already exists — ignore duplicate index error
}
}