Skip to content

Commit

Permalink
Merge pull request #11770 from peppy/add-osu-logins-migration
Browse files Browse the repository at this point in the history
Add `osu_logins` migration
  • Loading branch information
nanaya authored Jan 6, 2025
2 parents 65d1967 + 1cae1e2 commit 52ea0cf
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions database/migrations/2025_01_06_000000_create_osu_logins.php
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');
}
};

0 comments on commit 52ea0cf

Please sign in to comment.