M250505104636AlterTableAchievementUser.php 854 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace addons\Achievement\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * 添加团长列表是否手动创建字段
  6. * Class M250505104636AlterTableAchievementUser
  7. */
  8. class M250505104636AlterTableAchievementUser extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. try {
  16. $sql =<<<SQL
  17. ALTER TABLE `qimall_addons_achievement_user`
  18. ADD COLUMN `is_manual` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否手动添加[1:是 0:否]' AFTER `status`;
  19. SQL;
  20. $this->execute($sql);
  21. }catch (\Exception $e) {
  22. \Yii::error($e->getMessage());
  23. }
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function safeDown()
  29. {
  30. echo "M250505104636AlterTableAchievementUser cannot be reverted.\n";
  31. return false;
  32. }
  33. }