<?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('notes', function (Blueprint $table) {
            $table->foreignId('project_id')->nullable()->index()->after('campaign_id');
            $table->foreignId('case_id')->nullable()->index()->after('project_id');
            $table->foreignId('survey_id')->nullable()->index()->after('case_id');
        });
    }

    public function down(): void
    {
        Schema::table('notes', function (Blueprint $table) {
            $table->dropColumn(['project_id', 'case_id', 'survey_id']);
        });
    }
};
