M250310153612ModiFyColumnTypeToInt.php 610 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M250310153612ModiFyColumnTypeToInt
  6. */
  7. class M250310153612ModiFyColumnTypeToInt extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. ALTER TABLE `qimall_download`
  16. MODIFY COLUMN `type` int(3) NOT NULL DEFAULT 0 COMMENT '数据类型';
  17. SQL;
  18. $this->execute($sql);
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function safeDown()
  24. {
  25. echo "M250310153612ModiFyColumnTypeToInt cannot be reverted.\n";
  26. return false;
  27. }
  28. }