123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- use think\migration\Migrator;
- use think\migration\db\Column;
- class AddPickupToOrderTable extends Migrator
- {
- /**
- * Change Method.
- *
- * Write your reversible migrations using this method.
- *
- * More information on writing migrations is available here:
- * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
- *
- * The following commands can be used in this method and Phinx will
- * automatically reverse them when rolling back:
- *
- * createTable
- * renameTable
- * addColumn
- * renameColumn
- * addIndex
- * addForeignKey
- *
- * Remember to call "create()" or "update()" and NOT "save()" when working
- * with the Table class.
- */
- public function change()
- {
- $this->table('order')
- ->changeColumn('delivery_type', 'integer', array('limit' => 3, 'default' => 10, 'comment' => '配送方式(10快递配送 20门店自提)'))
- ->addColumn('hx_status', 'integer', array('limit' => 3, 'default' => 10, 'comment' => '核销状态(10未核销 20已核销)'))
- ->addColumn('hx_user_id', 'integer', array('limit' => 11, 'default' => 0, 'comment' => '核销人用户ID'))
- ->addColumn('hx_code', 'string', array('limit' => 100, 'default' => '', 'comment' => '核销码'))
- ->addColumn('pickup_time', 'integer', array('limit' => 11, 'default' => 0, 'comment' => '提货时间'))
- ->addColumn('pickup_deadline', 'integer', array('limit' => 11, 'default' => 0, 'comment' => '提货截止时间'))
- ->addColumn('shop_id', 'integer', array('limit' => 11, 'default' => 0, 'comment' => '订单自提门店id'))
- // ->addIndex(['hx_code'], ['unique' => true]) 由于核销码可以为空 所以没法增加唯一索引
- ->save();
- }
- }
|