M230222023350AlterMallIdToAddonsStoreCouponMemberRelate.php 1007 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230222023350AlterMallIdToAddonsStoreCouponMemberRelate
  6. */
  7. class M230222023350AlterMallIdToAddonsStoreCouponMemberRelate extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $res = \Yii::$app->db->schema->getTableSchema("qimall_addons_store_coupon_member_relate", true);
  15. if (!$res->getColumn('mall_id')) {
  16. $sql = "ALTER TABLE `qimall_addons_store_coupon_member_relate` ADD COLUMN `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城ID';";
  17. $this->execute($sql);
  18. }
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function safeDown()
  24. {
  25. }
  26. /*
  27. // Use up()/down() to run migration code without a transaction.
  28. public function up()
  29. {
  30. }
  31. public function down()
  32. {
  33. echo "M230222023350AlterMallIdToAddonsStoreCouponMemberRelate cannot be reverted.\n";
  34. return false;
  35. }
  36. */
  37. }