M220924103711AddGiveScoreSettlementColumnToQimallOrderMarketing.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. *
  6. * Class M220924103711AddGiveScoreSettlementColumnToQimallOrderMarketing
  7. */
  8. class M220924103711AddGiveScoreSettlementColumnToQimallOrderMarketing extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. try {
  16. $sql="ALTER TABLE qimall_order_marketing add `give_score_settlement` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '赠送积分的结算方式';";
  17. $this->execute($sql);
  18. }catch (\Exception $e){
  19. }
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function safeDown()
  25. {
  26. echo "M220924103711AddGiveScoreSettlementColumnToQimallOrderMarketing 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 "M220924103711AddGiveScoreSettlementColumnToQimallOrderMarketing cannot be reverted.\n";
  37. return false;
  38. }
  39. */
  40. }