M230922112750WriteOffUpdate.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace addons\WriteOff\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230922112750WriteOffUpdate
  6. */
  7. class M230922112750WriteOffUpdate extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "ALTER TABLE `qimall_addons_write_off_member_log` ADD COLUMN `code` int(8) NOT NULL DEFAULT 0 COMMENT '核销码';";
  15. $this->execute($sql);
  16. $sql = "ALTER TABLE `qimall_addons_write_off_level`
  17. ADD COLUMN `is_enable_promote_limit` tinyint(4) NULL DEFAULT 0 COMMENT '核销限制[0:关闭;1启用]',
  18. ADD COLUMN `promote_time` int(10) NULL DEFAULT 0 COMMENT '每日核销次数';";
  19. $this->execute($sql);
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function safeDown()
  25. {
  26. echo "M230922112750WriteOffUpdate 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 "M230922112750WriteOffUpdate cannot be reverted.\n";
  37. return false;
  38. }
  39. */
  40. }