M220907030905AddVideoUrlColumnFirstFrameColumnWatchTimesToQimallAddonsStoreCoupon.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Exception;
  4. use yii\db\Migration;
  5. /**
  6. * Class M220907030905AddVideoUrlColumnFirstFrameColumnWatchTimesToQimallAddonsStoreCoupon
  7. */
  8. class M220907030905AddVideoUrlColumnFirstFrameColumnWatchTimesToQimallAddonsStoreCoupon extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. try {
  16. $table = 'qimall_addons_store_coupon';
  17. $this->addColumn($table, 'video_url', $this->string()->defaultValue('')->comment('视频路径'));
  18. $this->addColumn($table, 'first_frame', $this->string()->defaultValue('')->comment('首帧'));
  19. $this->addColumn($table, 'watch_times', $this->integer()->defaultValue(0)->comment('观看多少秒领取成功'));
  20. }catch (\Exception $e){
  21. var_dump($e->getMessage());
  22. }
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function safeDown()
  28. {
  29. echo "M220907030905AddVideoUrlColumnFirstFrameColumnWatchTimesToQimallAddonsStoreCoupon cannot be reverted.\n";
  30. return false;
  31. }
  32. /*
  33. // Use up()/down() to run migration code without a transaction.
  34. public function up()
  35. {
  36. }
  37. public function down()
  38. {
  39. echo "M220907030905AddVideoUrlColumnFirstFrameColumnWatchTimesToQimallAddonsStoreCoupon cannot be reverted.\n";
  40. return false;
  41. }
  42. */
  43. }