Last active
October 8, 2015 14:08
-
-
Save lucassmacedo/f5e3df8fc6cf6d6548d1 to your computer and use it in GitHub Desktop.
Migrations tutorial step 2
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 | |
use Phinx\Migration\AbstractMigration; | |
use Phinx\Db\Adapter\MysqlAdapter; | |
class CartItems extends AbstractMigration { | |
public function up() { | |
$table = $this->table('cart_items'); | |
$table->addColumn('user_id', 'integer') | |
->addColumn('product_id', 'integer', array('limit' => MysqlAdapter::INT_BIG)) | |
->addColumn('subtype_id', 'integer', array('limit' => MysqlAdapter::INT_SMALL)) | |
->addColumn('quantity', 'integer', array('limit' => MysqlAdapter::INT_TINY)) | |
->create(); | |
} | |
public function down() { | |
$this->dropTable('posts'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment