<?php

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

return new class extends Migration
{
    public function up(): void
    {
        // ponds.type
        DB::statement("ALTER TABLE ponds MODIFY COLUMN `type` VARCHAR(50) NOT NULL DEFAULT 'concrete'");
        // ponds.water_source
        DB::statement("ALTER TABLE ponds MODIFY COLUMN `water_source` VARCHAR(50) NOT NULL DEFAULT 'borehole'");
        // feeding_logs.feeding_response
        DB::statement('ALTER TABLE feeding_logs MODIFY COLUMN `feeding_response` VARCHAR(50) NULL');
        // mortality_logs.probable_cause
        DB::statement('ALTER TABLE mortality_logs MODIFY COLUMN `probable_cause` VARCHAR(50) NULL');
        // treatment_logs.application_method
        DB::statement('ALTER TABLE treatment_logs MODIFY COLUMN `application_method` VARCHAR(50) NOT NULL');
        // harvest_records.harvest_type
        DB::statement("ALTER TABLE harvest_records MODIFY COLUMN `harvest_type` VARCHAR(50) NOT NULL DEFAULT 'full_harvest'");
        // expense_records.category
        DB::statement('ALTER TABLE expense_records MODIFY COLUMN `category` VARCHAR(50) NOT NULL');
    }

    public function down(): void
    {
        DB::statement("ALTER TABLE ponds MODIFY COLUMN `type` ENUM('concrete','tarpaulin','earthen','cage','ras') NOT NULL DEFAULT 'concrete'");
        DB::statement("ALTER TABLE ponds MODIFY COLUMN `water_source` ENUM('borehole','stream','municipal','harvested_rain') NOT NULL DEFAULT 'borehole'");
        DB::statement("ALTER TABLE feeding_logs MODIFY COLUMN `feeding_response` ENUM('excellent','good','poor','refused') NULL");
        DB::statement("ALTER TABLE mortality_logs MODIFY COLUMN `probable_cause` ENUM('disease','water_quality','predator','injury','unknown') NULL");
        DB::statement("ALTER TABLE treatment_logs MODIFY COLUMN `application_method` ENUM('bath','oral_feed','injection','pond_broadcast') NOT NULL");
        DB::statement("ALTER TABLE harvest_records MODIFY COLUMN `harvest_type` ENUM('full_harvest','partial_harvest') NOT NULL DEFAULT 'full_harvest'");
        DB::statement("ALTER TABLE expense_records MODIFY COLUMN `category` ENUM('fingerlings','feed','drugs_chemicals','labour','electricity','maintenance','transport','other') NOT NULL");
    }
};
