Created
August 13, 2013 01:07
-
-
Save zachflower/6216905 to your computer and use it in GitHub Desktop.
Example CodeIgniter Migration Script
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_Users extends CI_Migration { | |
public function up(){ | |
$this->dbforge->add_field("id int(11) unsigned NOT NULL AUTO_INCREMENT"); | |
$this->dbforge->add_field("email varchar(255) NOT NULL DEFAULT ''"); | |
$this->dbforge->add_field("password varchar(255) NOT NULL DEFAULT ''"); | |
$this->dbforge->add_key('id', TRUE); | |
$this->dbforge->add_key('email'); | |
$this->dbforge->create_table('users', TRUE); | |
} | |
public function down(){ | |
$this->dbforge->drop_table('users'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment