Created
April 21, 2016 13:09
-
-
Save ron4stoppable/c690bc62ff385ff790e90bf7927cae2d to your computer and use it in GitHub Desktop.
CI 3.0 Migrations to Create Session
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Migration_Create_Sessions extends CI_Migration { | |
public function up() | |
{ | |
$fields = array( | |
'id VARCHAR(40) DEFAULT \'0\' NOT NULL', | |
'ip_address VARCHAR(45) DEFAULT \'0\' NOT NULL', | |
'timestamp INT(10) unsigned DEFAULT 0 NOT NULL', | |
'data blob NOT NULL' | |
); | |
$this->dbforge->add_field($fields); | |
$this->dbforge->add_key('id', TRUE); | |
$this->dbforge->create_table('ci_sessions'); | |
$this->db->query('ALTER TABLE `ci_sessions` ADD KEY `ci_sessions_timestamp` (`timestamp`)'); | |
} | |
public function down() | |
{ | |
$this->dbforge->drop_table('ci_sessions'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment