2023050800-add_user_transfer_today.php 768 B

123456789101112131415161718192021222324
  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('ALTER TABLE user DROP COLUMN IF EXISTS `last_day_t`;');
  9. DB::getPdo()->exec("ALTER TABLE user ADD COLUMN IF NOT EXISTS `transfer_today` bigint(20) unsigned DEFAULT 0 COMMENT '账户今日所用流量';");
  10. return 2023050800;
  11. }
  12. public function down(): int
  13. {
  14. DB::getPdo()->exec("ALTER TABLE user ADD COLUMN IF NOT EXISTS `last_day_t` bigint(20) DEFAULT 0 COMMENT '今天之前已使用的流量';");
  15. DB::getPdo()->exec('ALTER TABLE user DROP COLUMN IF EXISTS `transfer_today`;');
  16. return 2023032600;
  17. }
  18. };