<?php
use Illuminate\Database\Migrations\Migration;use Illuminate\Database\Schema\Blueprint;use Illuminate\Support\Facades\Schema;
return new class extends Migration {public function up():void{Schema::table('activities',function(Blueprint $t){if(!Schema::hasColumn('activities','project_id'))$t->foreignId('project_id')->nullable()->index();if(!Schema::hasColumn('activities','case_id'))$t->foreignId('case_id')->nullable()->index();});}public function down():void{Schema::table('activities',function(Blueprint $t){foreach(['project_id','case_id'] as $column)if(Schema::hasColumn('activities',$column))$t->dropColumn($column);});}};
