M230718104253AlertSettingId.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230718104253AlertSettingId
  6. */
  7. class M230718104253AlertSettingId extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql = "ALTER TABLE `qimall_mall_setting`
  16. MODIFY COLUMN `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '表id' FIRST;";
  17. $sql.= "ALTER TABLE `qimall_addons_setting`
  18. MODIFY COLUMN `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '表id' FIRST;";
  19. $this->execute($sql);
  20. }catch (\Exception $e){
  21. }
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function safeDown()
  27. {
  28. echo "M230718104253AlertSettingId cannot be reverted.\n";
  29. return false;
  30. }
  31. /*
  32. // Use up()/down() to run migration code without a transaction.
  33. public function up()
  34. {
  35. }
  36. public function down()
  37. {
  38. echo "M230718104253AlertSettingId cannot be reverted.\n";
  39. return false;
  40. }
  41. */
  42. }