M240903105338AddColumnToUserDelLogTable.php 910 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240903105338AddColumnToUserDelLogTable
  6. */
  7. class M240903105338AddColumnToUserDelLogTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. ALTER TABLE `qimall_user_del_log`
  16. ADD COLUMN `is_recovered` tinyint UNSIGNED NOT NULL DEFAULT 0 COMMENT '恢复状态:0未恢复 1已恢复',
  17. ADD COLUMN `recover_time` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '恢复时间';
  18. SQL;
  19. $this->execute($sql);
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function safeDown()
  25. {
  26. return false;
  27. }
  28. /*
  29. // Use up()/down() to run migration code without a transaction.
  30. public function up()
  31. {
  32. }
  33. public function down()
  34. {
  35. echo "M240903105338AddColumnToUserDelLogTable cannot be reverted.\n";
  36. return false;
  37. }
  38. */
  39. }