-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11770 from peppy/add-osu-logins-migration
Add `osu_logins` migration
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
database/migrations/2025_01_06_000000_create_osu_logins.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
declare(strict_types=1); | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
// This is a legacy table. Migration is added for external projects' sake. | ||
if (Schema::hasTable('osu_logins')) { | ||
return; | ||
} | ||
|
||
Schema::create('osu_logins', function (Blueprint $table) { | ||
$table->unsignedInteger('user_id')->default(0); | ||
$table->string('ip', 100)->default(''); | ||
$table->timestamp('date')->useCurrent(); | ||
|
||
$table->index('user_id', 'user_id'); | ||
$table->index('date', 'date'); | ||
$table->index('ip', 'ip'); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::dropIfExists('osu_logins'); | ||
} | ||
}; |