M220817060601AlterQimallAddonsCourseChapter.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace addons\Course\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M220817060601AlterQimallAddonsCourseChapter
  6. */
  7. class M220817060601AlterQimallAddonsCourseChapter extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. }
  15. /**
  16. * {@inheritdoc}
  17. */
  18. public function safeDown()
  19. {
  20. echo "M220817060601AlterQimallAddonsCourseChapter cannot be reverted.\n";
  21. return false;
  22. }
  23. // Use up()/down() to run migration code without a transaction.
  24. public function up()
  25. {
  26. try{
  27. $sql="ALTER TABLE qimall_addons_course_chapter modify COLUMN video_url VARCHAR(1000)";
  28. $this->execute($sql);
  29. $sql="ALTER TABLE qimall_addons_course_chapter add select_type tinyint(1) not null default 2";
  30. $this->execute($sql);
  31. }catch (\Exception $e){
  32. }
  33. }
  34. public function down()
  35. {
  36. echo "M220817060601AlterQimallAddonsCourseChapter cannot be reverted.\n";
  37. return false;
  38. }
  39. }