<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class SessionTableHook {

	public function check_and_cleanup()
	{
		$ci =& get_instance();
		$ci->load->database();

        // 1️⃣ Create table if not exists
		if (!$ci->db->table_exists('ci_sessions')) {
			$ci->db->query("
				CREATE TABLE `ci_sessions` (
					`id` varchar(128) NOT NULL,
					`ip_address` varchar(45) NOT NULL,
					`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
					`data` blob NOT NULL,
					PRIMARY KEY (`id`),
					KEY `ci_sessions_timestamp` (`timestamp`)
					) ENGINE=InnoDB DEFAULT CHARSET=utf8;
				");
		}


	}
}
