<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::table('articles', function (Blueprint $table) {
            // Mengubah ENUM lama menjadi ENUM baru
            // Kita gunakan DB::statement karena Laravel terkadang sulit mengubah ENUM secara langsung via Blueprint
            DB::statement("ALTER TABLE articles MODIFY COLUMN status ENUM('aktif', 'non-aktif') DEFAULT 'aktif'");
        });
    }

    public function down()
    {
        Schema::table('articles', function (Blueprint $table) {
            // Kembalikan ke asal jika diperlukan (Rollback)
            DB::statement("ALTER TABLE articles MODIFY COLUMN status ENUM('draft', 'published') DEFAULT 'draft'");
        });
    }

    
};
