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
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:
+4
-4
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user