M240919120545AlterAddonsStoreSettings.php 845 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * 创建门店收银台区域奖励分佣字段
  6. * Class M240919120545AlterAddonsStoreSettings
  7. */
  8. class M240919120545AlterAddonsStoreSettings extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. try {
  16. $sql = <<<SQL
  17. ALTER TABLE `qimall_addons_store_settings`
  18. ADD COLUMN `cashier_area_settings` text NULL COMMENT '收银台区域奖励配置' AFTER `cashier_agent_settings`;
  19. SQL;
  20. $this->execute($sql);
  21. } catch (\Exception $e) {
  22. echo '迁移失败:' . $e->getMessage();
  23. }
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function safeDown()
  29. {
  30. echo "M240919120545AlterAddonsStoreSettings cannot be reverted.\n";
  31. return false;
  32. }
  33. }