M230904102932CloudStockFillStatisticsUpdate.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace addons\CloudStock\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230904102932CloudStockFillStatisticsUpdate
  6. */
  7. class M230904102932CloudStockFillStatisticsUpdate extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "ALTER TABLE `qimall_addons_cloud_stock_fill_statistics` MODIFY COLUMN `self_num` decimal(12,2) NOT NULL COMMENT '自身补货数量',MODIFY COLUMN `direct_num` decimal(12,2) NOT NULL COMMENT '直推们的数量,等级一致',MODIFY COLUMN `indirect_num` decimal(12,2) NOT NULL COMMENT '间推们数量,等级一致';";
  15. $this->execute($sql);
  16. $sql = "ALTER TABLE `qimall_addons_cloud_stock_fill_statistics` ADD COLUMN `award_proportion_calculate_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '计算方式'";
  17. $this->execute($sql);
  18. $sql = "CREATE TABLE `qimall_addons_cloud_stock_increase_by_platform_log` (
  19. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  20. `mall_id` int(11) NOT NULL COMMENT '商城id',
  21. `user_id` int(11) NOT NULL COMMENT '增加库存代理商用户id',
  22. `goods_id` int(11) NOT NULL COMMENT '商品id',
  23. `changes_type` int(11) NOT NULL COMMENT '库存变动类型;100向上级补货;101上级给自己配货;102退货退库存;103系统添加;104平台补货赠送;105购买礼包赠送;',
  24. `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单id',
  25. `order_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'order类型,1:会员购买订单,2:补货订单;',
  26. `num` int(11) NOT NULL COMMENT '增加数量',
  27. `fill_unit_price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '补货单价',
  28. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  29. `created_at` int(11) NOT NULL DEFAULT '0',
  30. `updated_at` int(11) NOT NULL DEFAULT '0',
  31. PRIMARY KEY (`id`) USING BTREE
  32. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='补货记录表';";
  33. $this->execute($sql);
  34. }
  35. /**
  36. * {@inheritdoc}
  37. */
  38. public function safeDown()
  39. {
  40. echo "M230904102932CloudStockFillStatisticsUpdate cannot be reverted.\n";
  41. return false;
  42. }
  43. /*
  44. // Use up()/down() to run migration code without a transaction.
  45. public function up()
  46. {
  47. }
  48. public function down()
  49. {
  50. echo "M230904102932CloudStockFillStatisticsUpdate cannot be reverted.\n";
  51. return false;
  52. }
  53. */
  54. }