<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    public function up(): void
    {
        DB::statement("UPDATE episodes SET source = 'bunnycdn' WHERE source NOT IN ('bunnycdn','external','direct','anizium')");
        DB::statement("ALTER TABLE episodes MODIFY COLUMN source ENUM('bunnycdn','external','direct','anizium') NOT NULL DEFAULT 'bunnycdn'");
    }

    public function down(): void
    {
        DB::statement("UPDATE episodes SET source = 'external' WHERE source = 'anizium'");
        DB::statement("ALTER TABLE episodes MODIFY COLUMN source ENUM('bunnycdn','external','direct') NOT NULL DEFAULT 'bunnycdn'");
    }
};
