Created
February 3, 2011 21:16
-
-
Save halfdan/810213 to your computer and use it in GitHub Desktop.
ActiveRecord\Migration - CreateTable
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 CreateUsers extends ActiveRecord\Migration { | |
public function up() { | |
$this->create_table('users', array( | |
// <field> => array(<type>, <length>, <nullable>) | |
'name' => array('varchar', 12, FALSE), | |
'email' => array('varchar', 255, FALSE) | |
)); | |
} | |
public function down() { | |
$this->drop_table('users'); | |
} | |
} |
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 AddTableUsers extends ActiveRecord\Migration\Base { | |
public function up() { | |
$columns = array( | |
'name' => array( | |
'type' => 'string', | |
'length' => 12, | |
'notnull' => TRUE | |
), | |
'email' => array( | |
'type' => 'varchar', | |
'length' => 25 | |
) | |
); | |
$this->createTable('users', $columns, array('extra' => "ENGINE=INNODB")); | |
} | |
public function down() { | |
$this->dropTable('users'); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@silentworks: I've been working on this for a while. Not sure if I'll finish it any time soon.