· 7 years ago · Jan 20, 2019, 09:50 AM
1CREATE TABLE IF NOT EXISTS `ci_sessions` (
2 `session_id` varchar(40) COLLATE utf8_bin NOT NULL DEFAULT '0',
3 `ip_address` varchar(16) COLLATE utf8_bin NOT NULL DEFAULT '0',
4 `user_agent` varchar(150) COLLATE utf8_bin NOT NULL,
5 `last_activity` int(10) unsigned NOT NULL DEFAULT '0',
6 `user_data` text COLLATE utf8_bin NOT NULL,
7 PRIMARY KEY (`session_id`)
8) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
9
10$this->dbforge->add_field(array(
11 'session_id' => array(
12 'type' => 'VARCHAR',
13 'constraint' => '40'
14 ),
15 'ip_address' => array(
16 'type' => 'VARCHAR',
17 'constraint' => '16'
18 ),
19 'user_agent' => array(
20 'type' => 'VARCHAR',
21 'constraint' => '150'
22 ),
23 'last_activity' => array(
24 'type' => 'INT',
25 'constraint' => '10'
26 ),
27 'user_data' => array(
28 'type' => 'TEXT'
29 )
30 ));
31
32 $this->dbforge->add_key('session_id', TRUE);
33 $this->dbforge->create_table('ci_sessions');