<?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::create('crm_assignment_histories', function (Blueprint $table) {
            $table->id();
            $table->foreignId('business_id')->index();
            $table->morphs('assignable');
            $table->foreignId('user_id')->index();
            $table->foreignId('changed_by')->nullable()->index();
            $table->string('action');
            $table->timestamps();
        });
    }
    public function down(): void { Schema::dropIfExists('crm_assignment_histories'); }
};
