M230613020712AreaV1BiJieShengWu.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. namespace addons\Area\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230613020712AreaV1BiJieShengWu
  6. */
  7. class M230613020712AreaV1BiJieShengWu extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $this->execute("CREATE TABLE `qimall_addons_area_goods` (
  15. `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  16. `mall_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商城id',
  17. `user_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '会员id',
  18. `status` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  19. `created_at` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
  20. `updated_at` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间',
  21. `goods_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商品ID',
  22. PRIMARY KEY (`id`) USING BTREE,
  23. INDEX `user_id` (`user_id`) USING BTREE,
  24. INDEX `goods_id` (`goods_id`) USING BTREE
  25. )
  26. COMMENT='区域代理所代理的指定商品'
  27. COLLATE='utf8mb4_general_ci'
  28. ENGINE=InnoDB;");
  29. $this->execute("CREATE TABLE `qimall_addons_area_commission_log` (
  30. `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  31. `mall_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商城id',
  32. `user_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '会员id',
  33. `status` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  34. `created_at` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
  35. `updated_at` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间',
  36. `goods_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商品ID',
  37. `order_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '订单ID',
  38. `order_no` CHAR(26) NOT NULL DEFAULT '' COMMENT '订单编号' COLLATE 'utf8mb4_general_ci',
  39. `commission_rate` DECIMAL(10,7) UNSIGNED NOT NULL DEFAULT '0.0000000' COMMENT '佣金比例',
  40. `commission` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '佣金',
  41. `commission_status` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '佣金状态0未发放,1已发放',
  42. `area_level` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '代理等级',
  43. `type` VARCHAR(20) NOT NULL DEFAULT '0' COMMENT '类型' COLLATE 'utf8mb4_general_ci',
  44. `direction` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '1入,2出',
  45. `order_detail_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '订单详情ID',
  46. `is_fixed` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否为固定金额',
  47. PRIMARY KEY (`id`) USING BTREE,
  48. INDEX `user_id` (`user_id`) USING BTREE,
  49. INDEX `goods_id` (`goods_id`) USING BTREE,
  50. INDEX `created_at` (`created_at`) USING BTREE,
  51. INDEX `order_detail_id` (`order_detail_id`) USING BTREE
  52. )
  53. COMMENT='商品分佣明细'
  54. COLLATE='utf8mb4_general_ci'
  55. ENGINE=InnoDB;");
  56. $this->execute("ALTER TABLE `qimall_addons_area_agent`
  57. ADD COLUMN `is_enable_dividend` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否参与分红' AFTER `total_score`;");
  58. $this->execute("ALTER TABLE `qimall_addons_area_apply`
  59. ADD COLUMN `agent_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '代理ID' AFTER `updated_at`;");
  60. }
  61. /**
  62. * {@inheritdoc}
  63. */
  64. public function safeDown()
  65. {
  66. echo "M230613020712AreaV1BiJieShengWu cannot be reverted.\n";
  67. return false;
  68. }
  69. /*
  70. // Use up()/down() to run migration code without a transaction.
  71. public function up()
  72. {
  73. }
  74. public function down()
  75. {
  76. echo "M230613020712AreaV1BiJieShengWu cannot be reverted.\n";
  77. return false;
  78. }
  79. */
  80. }