Skip to content

Instantly share code, notes, and snippets.

@zachflower
Created August 13, 2013 01:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachflower/6216905 to your computer and use it in GitHub Desktop.
Save zachflower/6216905 to your computer and use it in GitHub Desktop.
Example CodeIgniter Migration Script
<?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