M240906023848CreateAgentSupplierCommissionTable.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace addons\Agent\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Handles the creation of table `{{%agent_supplier_commission}}`.
  6. */
  7. class M240906023848CreateAgentSupplierCommissionTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. CREATE TABLE `qimall_addons_agent_supplier_commission` (
  16. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  17. `mall_id` int(11) unsigned NOT NULL DEFAULT '0',
  18. `buy_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '买家id',
  19. `buy_level` int(11) NOT NULL DEFAULT '0' COMMENT '买家身份',
  20. `seller_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '卖家id',
  21. `seller_level` int(11) NOT NULL DEFAULT '0' COMMENT '卖家身份',
  22. `order_no` varchar(100) NOT NULL DEFAULT '' COMMENT '会员订单号',
  23. `supplier_order_no` varchar(100) NOT NULL DEFAULT '' COMMENT '供应商订单号',
  24. `goods_nums` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品数量',
  25. `stock_nums` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '库存加减',
  26. `payment_amount` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '货款金额',
  27. `profit` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '利润',
  28. `pay_time` int(11) NOT NULL DEFAULT '0' COMMENT '订单支付时间',
  29. `created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间戳',
  30. `updated_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间戳',
  31. `capital_type` varchar(50) NOT NULL DEFAULT '' COMMENT '奖励类型',
  32. `source_table` varchar(100) NOT NULL DEFAULT '',
  33. `source_table_id` int(10) unsigned NOT NULL DEFAULT '0',
  34. PRIMARY KEY (`id`) USING BTREE,
  35. KEY `idx_order_no` (`order_no`) USING BTREE,
  36. KEY `idx_buy_user_id` (`buy_user_id`) USING BTREE,
  37. KEY `idx_seller_user_id` (`seller_user_id`) USING BTREE,
  38. KEY `pay_time` (`pay_time`,`order_no`)
  39. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商订单';
  40. SQL;
  41. $this->execute($sql);
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function safeDown()
  47. {
  48. return false;
  49. }
  50. }