<?php

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

/**
 * 将旧版期号状态值迁移为《04-领域字典》约定。
 */
return new class extends Migration
{
    public function up(): void
    {
        DB::table('draws')->where('status', 'pending_review')->update(['status' => 'review']);
        DB::table('draws')->where('status', 'published')->update(['status' => 'cooldown']);
    }

    public function down(): void
    {
        DB::table('draws')->where('status', 'review')->update(['status' => 'pending_review']);
        DB::table('draws')->where('status', 'cooldown')->update(['status' => 'published']);
    }
};
