<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * kategori_id menjadi nullable: member tidak memilih kategori saat buat campaign
     * (BR-12); admin menetapkan kategori kemudian via edit/approve.
     */
    public function up(): void
    {
        Schema::table('ads', function (Blueprint $table) {
            $table->foreignId('kategori_id')->nullable()->change();
        });
    }

    public function down(): void
    {
        Schema::table('ads', function (Blueprint $table) {
            $table->foreignId('kategori_id')->nullable(false)->change();
        });
    }
};
