<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;
use CodeIgniter\Database\Config;

class UpdateRepairRef extends Migration
{
    public function up()
    {
        $db = \Config\Database::connect();

        $sql = "ALTER TABLE `hampo`.`tbl_repair` CHANGE `rep_letter` `rep_ref_src` VARCHAR(1) CHARSET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT 'e' NOT NULL, ADD COLUMN `rep_ref_no` VARCHAR(30) NULL AFTER `rep_ref_src`;"; 
        
        $db->query($sql);


        $sql = "update tbl_repair set rep_ref_no = '';"; 
        
        $db->query($sql);

    }

    
    public function down()
    {
        // $db = \Config\Database::connect();

        // $sql = "UPDATE tbl_role_menu SET mnu_url = ? where mnu_uid='d8698c96'";
        // $mnu_url = 'admin/inventory/inventry/invref'; 
        // $db->query($sql, [$mnu_url]);

        // $sql = "UPDATE tbl_role_menu SET mnu_url = ? where mnu_uid='d8698df8'";
        // $mnu_url = 'admin/inventory/inventry/invreflist'; 
        // $db->query($sql, [$mnu_url]);

        // $sql = "UPDATE tbl_role_menu SET mnu_url = ? where mnu_uid=' '";
        // $mnu_url = 'admin/inventory/inventry/invref'; 
        // $db->query($sql, [$mnu_url]);
    }
}
