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