fuc-new/db/migrations/2023081800-add_user_contact_method.php
hellcat 1fe8673f62 1
2025-10-01 13:34:29 +08:00

27 lines
577 B
PHP
Executable File

<?php
declare(strict_types=1);
use App\Interfaces\MigrationInterface;
use App\Services\DB;
return new class() implements MigrationInterface {
public function up(): int
{
DB::getPdo()->exec("
ALTER TABLE user ADD COLUMN IF NOT EXISTS `contact_method` smallint(6) NOT NULL DEFAULT 1 COMMENT '偏好的联系方式';
");
return 2023081800;
}
public function down(): int
{
DB::getPdo()->exec('
ALTER TABLE user DROP COLUMN IF EXISTS `contact_method`;
');
return 2023080900;
}
};