db->field_exists('is_system', 'roles')) $this->db->query("ALTER TABLE roles ADD is_system TINYINT(1) NOT NULL DEFAULT 0 AFTER is_active"); if (!$this->db->field_exists('is_super_admin', 'roles')) $this->db->query("ALTER TABLE roles ADD is_super_admin TINYINT(1) NOT NULL DEFAULT 0 AFTER is_system"); if (!$this->db->field_exists('created_at', 'roles')) $this->db->query("ALTER TABLE roles ADD created_at DATETIME NULL AFTER is_super_admin"); if (!$this->db->field_exists('updated_at', 'roles')) $this->db->query("ALTER TABLE roles ADD updated_at DATETIME NULL AFTER created_at"); $this->db->set('is_system', 1)->update('roles'); $this->db->where('nama_role', 'Admin')->update('roles', array( 'is_super_admin' => 1, 'description' => 'Master Admin: akses penuh seluruh modul, transaksi, posting, approval, konfigurasi, pengguna dan role.', 'is_active' => 1 )); } public function down() { throw new RuntimeException('Gunakan backup untuk rollback manajemen role.'); } }