20211208022028_add_pickup_to_order_table.php 1.8 KB

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