2023081800-add_user_contact_method.php 577 B

1234567891011121314151617181920212223242526
  1. <?php
  2. declare(strict_types=1);
  3. use App\Interfaces\MigrationInterface;
  4. use App\Services\DB;
  5. return new class() implements MigrationInterface {
  6. public function up(): int
  7. {
  8. DB::getPdo()->exec("
  9. ALTER TABLE user ADD COLUMN IF NOT EXISTS `contact_method` smallint(6) NOT NULL DEFAULT 1 COMMENT '偏好的联系方式';
  10. ");
  11. return 2023081800;
  12. }
  13. public function down(): int
  14. {
  15. DB::getPdo()->exec('
  16. ALTER TABLE user DROP COLUMN IF EXISTS `contact_method`;
  17. ');
  18. return 2023080900;
  19. }
  20. };