<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AlterTanggalPengambilanToDate extends Migration
{
    public function up()
    {
        // Modify columns from DATETIME to DATE
        $fields = [
            'tanggal_pengambilan' => [
                'type' => 'DATE',
                'null' => true,
            ],
            'tanggal_pengambilan_konfirmasi' => [
                'type' => 'DATE',
                'null' => true,
            ],
        ];

        $this->forge->modifyColumn('tabel_permintaan_custom', $fields);
    }

    public function down()
    {
        // Revert back to DATETIME
        $fields = [
            'tanggal_pengambilan' => [
                'type' => 'DATETIME',
                'null' => true,
            ],
            'tanggal_pengambilan_konfirmasi' => [
                'type' => 'DATETIME',
                'null' => true,
            ],
        ];

        $this->forge->modifyColumn('tabel_permintaan_custom', $fields);
    }
}
