Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add osu_logins migration #11770

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
}
};
Loading