20220530072727_create_member_order_table.php 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateMemberOrderTable 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('member_order',array('order_id' => true,'primary_key' => ['order_id'],'engine'=>'InnoDB','comment'=>'米卡订单'))
  30. ->addColumn('order_no', 'string',array('limit' => 255,'default'=>'','comment'=>'订单号'))
  31. ->addColumn('user_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'购买者用户id'))
  32. ->addColumn('user_mobile', 'string',array('limit' => 255,'default'=>'','comment'=>'购买者手机号'))
  33. ->addColumn('member_cards_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'会员类型id'))
  34. ->addColumn('member_cards_sale_price', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'促销价'))
  35. ->addColumn('member_cards_origin_price', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'原价'))
  36. ->addColumn('pay_price', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>2,'signed'=>false,'default'=>0,'comment'=>'实际支付金额'))
  37. ->addColumn('pay_status', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'支付状态 0 待支付 1 支付成功 2支付失败'))
  38. ->addColumn('pay_type', 'integer',array('limit' => 10,'signed'=>false,'default'=>0,'comment'=>'支付方式(10余额支付 20微信支付)'))
  39. ->addColumn('order_status', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'订单状态(10进行中 20取消 21待取消 30已完成 40已关闭)'))
  40. ->addColumn('pay_time', 'datetime', array('null' => true,'comment'=>'支付时间'))
  41. ->addColumn('from_member_time', 'datetime', array('null' => true,'comment'=>'续费开始时间'))
  42. ->addColumn('to_member_time', 'datetime', array('null' => true,'comment'=>'续费结束时间'))
  43. ->addColumn('update_time', 'datetime', array('null' => true,'comment'=>'订单更新时间'))
  44. ->addColumn('create_time', 'datetime', array('null' => true,'comment'=>'订单创建时间'))
  45. ->addColumn('cancel_time', 'datetime', array('null' => true,'comment'=>'订单取消时间'))
  46. ->addColumn('cancel_reason', 'string',array('limit' => 255,'default'=>'','comment'=>'取消原因'))
  47. ->addColumn('remark', 'string',array('limit' => 255,'default'=>'','comment'=>'订单备注'))
  48. ->addColumn('is_del', 'integer',array('limit' => 11,'signed'=>false,'default'=>0,'comment'=>'删除状态 0 未删除 1 已删除'))
  49. ->addColumn('store_id', 'integer',array('limit' => 11,'signed'=>false,'default'=>10001,'comment'=>'商城ID'))
  50. ->addColumn('transaction_id', 'string',array('limit' => 255,'default'=>'','comment'=>'微信支付交易流水号'))
  51. ->create();
  52. }
  53. }