M221011053246AddStoreIdColumnToQimallAddonsCouponUserRelate.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace addons\Coupon\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M221011053246AddStoreIdColumnToQimallAddonsCouponUserRelate
  6. */
  7. class M221011053246AddStoreIdColumnToQimallAddonsCouponUserRelate extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. /**
  13. * {@inheritdoc}
  14. */
  15. public function safeUp()
  16. {
  17. try {
  18. $this->execute("alter table qimall_addons_coupon_user_relate add `store_id` int(10) NOT NULL DEFAULT '0' COMMENT '门店id'");
  19. }catch (\Exception $e){
  20. var_dump($e->getMessage());
  21. }
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function safeDown()
  27. {
  28. echo "M221011053246AddStoreIdColumnToQimallAddonsCouponUserRelate cannot be reverted.\n";
  29. return false;
  30. }
  31. /*
  32. // Use up()/down() to run migration code without a transaction.
  33. public function up()
  34. {
  35. }
  36. public function down()
  37. {
  38. echo "M221011053246AddStoreIdColumnToQimallAddonsCouponUserRelate cannot be reverted.\n";
  39. return false;
  40. }
  41. */
  42. }