據我所知limit optionMysqlAdapter::INT_REGULAR
就像Phinx中的預定義類型。但是你也可以使用你自己的limit
變量。
下面是一個例子:
// using Phinx 0.5.4
public function change() {
$table = $this->table('papers');
$table->addColumn('user_id', 'integer', ['limit' => 2])
->addColumn('book_id', 'integer') // by default will be int(11)
->addColumn('bank_id', 'integer', ['limit' => 32])
->create();
}
MySQL的描述結果:
+---------+---------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+---------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| user_id | int(2) | NO | | NULL | |
| book_id | int(11) | NO | | NULL | |
| bank_id | int(32) | NO | | NULL | |
+---------+---------+------+-----+---------+----------------+
要獲得更多信息,請檢查getPhinxType()
功能getSqlType()
和source codesource code。
來源
2016-06-22 09:40:57
tsg