fuc/db/migrations/2023081800-add_user_contact_method.php
2025-02-23 13:30:57 +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;
}
};