M250703072236AlterQimallAddonsStoreCensus.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use addons\Store\common\services\StoreFinanceService;
  4. use common\enums\RabbitMqEnum;
  5. use yii\db\Migration;
  6. /**
  7. * Class M250703072236AlterQimallAddonsStoreCensus
  8. */
  9. class M250703072236AlterQimallAddonsStoreCensus extends Migration
  10. {
  11. /**
  12. * {@inheritdoc}
  13. */
  14. public function safeUp()
  15. {
  16. $sql = "ALTER TABLE `qimall_addons_store_census`
  17. ADD COLUMN `cashier_order_nums` int(11) NOT NULL DEFAULT 0 COMMENT '收银台订单数';";
  18. $this->execute($sql);
  19. \Yii::$app->services->rabbitMq->push(RabbitMqEnum::EXCHANGE_LONG_DURATION, RabbitMqEnum::LONG_DURATION_QUEUE, [], StoreFinanceService::class, 'staticsCashierOrderNum');
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function safeDown()
  25. {
  26. echo "M250703072236AlterQimallAddonsStoreCensus cannot be reverted.\n";
  27. return false;
  28. }
  29. /*
  30. // Use up()/down() to run migration code without a transaction.
  31. public function up()
  32. {
  33. }
  34. public function down()
  35. {
  36. echo "M250703072236AlterQimallAddonsStoreCensus cannot be reverted.\n";
  37. return false;
  38. }
  39. */
  40. }