M240405162535AlertQimallAddonsRebateBuy.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace addons\Rebate\console\migrations;
  3. use common\models\common\Addons;
  4. use yii\db\Migration;
  5. /**
  6. * Class M240405162535AlertQimallAddonsRebateBuy
  7. */
  8. class M240405162535AlertQimallAddonsRebateBuy extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. try {
  16. $sql = "ALTER TABLE `qimall_addons_rebate_buy` ADD COLUMN `order_settlement_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '订单结算状态[0:未达成;1:已达成]';";
  17. $sql.= "UPDATE `qimall_addons_rebate_buy` SET `order_settlement_status` = 1;";
  18. $this->execute($sql);
  19. } catch (\Exception $e) {
  20. }
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function safeDown()
  26. {
  27. echo "M240405162535AlertQimallAddonsRebateBuy cannot be reverted.\n";
  28. return false;
  29. }
  30. /*
  31. // Use up()/down() to run migration code without a transaction.
  32. public function up()
  33. {
  34. }
  35. public function down()
  36. {
  37. echo "M240405162535AlertQimallAddonsRebateBuy cannot be reverted.\n";
  38. return false;
  39. }
  40. */
  41. }