M240726033257UpdateQimallPrintLogTable.php 864 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace addons\Printer\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240726033257UpdateQimallPrintLogTable
  6. */
  7. class M240726033257UpdateQimallPrintLogTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql = <<<SQL
  16. ALTER TABLE `qimall_addons_printer_log`
  17. MODIFY COLUMN `status` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '打印状态,0: 失败,1: 成功';
  18. SQL;
  19. $this->execute($sql);
  20. } catch (\Exception $e) {
  21. echo "Error modifying column in table qimall_addons_printer_log: " . $e->getMessage() . "\n";
  22. }
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function safeDown()
  28. {
  29. echo "M240726033257UpdateQimallPrintLogTable cannot be reverted.\n";
  30. return false;
  31. }
  32. }