<?php

namespace App\Database\Migrations;

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

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

        $sql = "ALTER TABLE `hampo`.`tbl_org_info` ADD COLUMN `org_key` text NULL AFTER `org_update`, ADD COLUMN `org_meta` text NULL AFTER `org_key`, ADD COLUMN `org_user` VARCHAR(30) NULL AFTER `org_meta`"; 
        
        $db->query($sql);

        $sql = "UPDATE tbl_org_info SET org_key = ?, org_meta = ?, org_user = ? where org_id='1'";
        $org_key = 'HaMPoV4hBxRmC84nKzTpYgE3dMU1@SBL'; 
        $org_meta = 'PVbJl+dAA6/uUjX3o09VkGNyaWNTRndGMXNoRFNnPT0=XXXXXXXXXXXXXXXXXXXX'; 
        $org_user = 'usr0000000000000'; 
        $db->query($sql, [$org_key, $org_meta, $org_user ]);

    }

    
    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]);
    }
}
