M230127181906MembersCardAdd.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Exception;
  4. use yii\db\Migration;
  5. /**
  6. * Class M230127181906MembersCardAdd
  7. */
  8. class M230127181906MembersCardAdd extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. try {
  16. /*亲友卡新增*/
  17. $sql = "ALTER TABLE `qimall_addons_store_order_marketing` ADD COLUMN `user_card_id` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户会员卡id map';";
  18. $this->execute($sql);
  19. }catch (\Exception $e){
  20. }
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function safeDown()
  26. {
  27. echo "M230127181906MembersCardAdd 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 "M230127181906MembersCardAdd cannot be reverted.\n";
  38. return false;
  39. }
  40. */
  41. }