20220428013831_create_commissions_detail_order_table.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. use think\migration\Migrator;
  3. use think\migration\db\Column;
  4. class CreateCommissionsDetailOrderTable 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('commissions_detail_order', array('id' => true, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'comment' => '订单分佣明细'))
  30. ->addColumn('user_id', 'integer', array('limit' => 11, 'signed' => false, 'default' => 0, 'comment' => '用户ID'))
  31. ->addColumn('order_id', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'订单ID'))
  32. ->addColumn('clearing_money', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>4,'signed'=>false,'default'=>0,'comment'=>'结算金额'))
  33. ->addColumn('clearing_money_amount', 'decimal',array('limit' => 11,'precision'=>10,'scale'=>4,'signed'=>false,'default'=>0,'comment'=>'结算金额累计'))
  34. ->addColumn('clearing_status', 'integer',array('limit' => 4, 'signed' => false, 'default'=> 0,'comment'=>'结算状态,0:待结算,1:已结算 2:已退款'))
  35. ->addColumn('shop_id', 'integer',array('limit' => 10, 'signed' => false, 'default'=> 0,'comment'=>'门店ID'))
  36. ->addColumn('role', 'integer',array('limit' => 4, 'signed' => false, 'default'=> 0,'comment'=>'用户角色1:普通用户,2:店老板,3:店长,4:店员'))
  37. ->addColumn('buyer_user_id', 'integer',array('limit' => 11, 'signed' => false, 'default'=> 0,'comment'=>'购买人'))
  38. ->addColumn('commission_level', 'integer',array('limit' => 4, 'signed' => false, 'default'=> 1,'comment'=>'1:直接佣金,2:间接佣金'))
  39. ->addColumn('seller_grade', 'integer',array('limit' => 4, 'signed' => false, 'default'=> 0,'comment'=>'分销员等级'))
  40. ->addColumn('commission_percent', 'integer',array('limit' => 4, 'signed' => false, 'default'=> 0,'comment'=>'分佣比例'))
  41. ->addColumn('order_create_time', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '订单创建时间'))
  42. ->addColumn('order_sale_volume', 'decimal', array('limit' => 11,'precision'=>10,'scale'=>4,'signed' => false, 'default' => 0, 'comment' => '订单销售额'))
  43. ->addColumn('remark', 'string', array('limit' => 64, 'default' => '', 'comment' => '备注'))
  44. ->addColumn('is_delete', 'integer',array('limit' => 4, 'signed' => false, 'default'=> 0,'comment'=>'删除0:可用,1:禁用'))
  45. ->addColumn('create_time', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '创建时间'))
  46. ->addColumn('update_time', 'integer', array('limit' => 10,'signed' => false, 'default' => 0, 'comment' => '更新时间'))
  47. ->create();
  48. }
  49. }