<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddUpdatedAtToTbMaklon extends Migration
{
    public function up(): void
    {
        if (!$this->db->fieldExists('updated_at', 'tb_maklon')) {
            $this->db->query("
                ALTER TABLE `tb_maklon`
                ADD COLUMN `updated_at` DATETIME NULL DEFAULT NULL
                AFTER `created_at`
            ");
        }
    }

    public function down(): void
    {
        $this->db->query("ALTER TABLE `tb_maklon` DROP COLUMN IF EXISTS `updated_at`");
    }
}