Skip to content

Instantly share code, notes, and snippets.

@lucassmacedo
Last active October 8, 2015 14:08
Show Gist options
  • Save lucassmacedo/f5e3df8fc6cf6d6548d1 to your computer and use it in GitHub Desktop.
Save lucassmacedo/f5e3df8fc6cf6d6548d1 to your computer and use it in GitHub Desktop.
Migrations tutorial step 2
<?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