diff --git a/database/migrations/2026_06_11_071431_add_semester_to_student_class_table.php b/database/migrations/2026_06_11_071431_add_semester_to_student_class_table.php index 6589bb92..be3382c8 100644 --- a/database/migrations/2026_06_11_071431_add_semester_to_student_class_table.php +++ b/database/migrations/2026_06_11_071431_add_semester_to_student_class_table.php @@ -11,6 +11,9 @@ return new class extends Migration */ public function up(): void { + if (Schema::hasColumn('student_class', 'semester')) { + return; + } Schema::table('student_class', function (Blueprint $table) { $table->string('semester', 255)->default('')->after('is_event_only'); }); diff --git a/database/migrations/2026_06_11_074642_add_inventory_item_id_to_purchase_order_items.php b/database/migrations/2026_06_11_074642_add_inventory_item_id_to_purchase_order_items.php index 9fe09787..f76723d5 100644 --- a/database/migrations/2026_06_11_074642_add_inventory_item_id_to_purchase_order_items.php +++ b/database/migrations/2026_06_11_074642_add_inventory_item_id_to_purchase_order_items.php @@ -18,9 +18,10 @@ return new class extends Migration } }); - // Add index if it doesn't exist - $indexExists = DB::select("SHOW INDEX FROM purchase_order_items WHERE Key_name = 'po_items_inventory_item_idx'"); - if (empty($indexExists)) { + // 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'])) { Schema::table('purchase_order_items', function (Blueprint $table) { $table->index('inventory_item_id', 'po_items_inventory_item_idx'); });