2023021600-drop_user_token.php 905 B

1234567891011121314151617181920212223242526272829303132
  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('DROP TABLE IF EXISTS `user_token`');
  9. return 2023021600;
  10. }
  11. public function down(): int
  12. {
  13. DB::getPdo()->exec(
  14. 'CREATE TABLE IF NOT EXISTS `user_token` (
  15. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  16. `token` varchar(255) DEFAULT NULL,
  17. `user_id` bigint(20) unsigned DEFAULT NULL,
  18. `create_time` bigint(20) unsigned DEFAULT NULL,
  19. `expire_time` bigint(20) DEFAULT NULL,
  20. PRIMARY KEY (`id`),
  21. KEY `user_id` (`user_id`)
  22. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;'
  23. );
  24. return 2023020100;
  25. }
  26. };