| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Exception;
- use yii\db\Migration;
- /**
- * Class M220907030905AddVideoUrlColumnFirstFrameColumnWatchTimesToQimallAddonsStoreCoupon
- */
- class M220907030905AddVideoUrlColumnFirstFrameColumnWatchTimesToQimallAddonsStoreCoupon extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_store_coupon';
- $this->addColumn($table, 'video_url', $this->string()->defaultValue('')->comment('视频路径'));
- $this->addColumn($table, 'first_frame', $this->string()->defaultValue('')->comment('首帧'));
- $this->addColumn($table, 'watch_times', $this->integer()->defaultValue(0)->comment('观看多少秒领取成功'));
- }catch (\Exception $e){
- var_dump($e->getMessage());
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M220907030905AddVideoUrlColumnFirstFrameColumnWatchTimesToQimallAddonsStoreCoupon cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M220907030905AddVideoUrlColumnFirstFrameColumnWatchTimesToQimallAddonsStoreCoupon cannot be reverted.\n";
- return false;
- }
- */
- }
|