the browser-facing portion of osu!
1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6declare(strict_types=1);
7
8use Illuminate\Database\Migrations\Migration;
9use Illuminate\Database\Schema\Blueprint;
10use Illuminate\Support\Facades\Schema;
11
12return new class extends Migration
13{
14 public function up(): void
15 {
16 // This is a legacy table. Migration is added for external projects' sake.
17 if (Schema::hasTable('osu_logins')) {
18 return;
19 }
20
21 Schema::create('osu_logins', function (Blueprint $table) {
22 $table->unsignedInteger('user_id')->default(0);
23 $table->string('ip', 100)->default('');
24 $table->timestamp('date')->useCurrent();
25
26 $table->index('user_id', 'user_id');
27 $table->index('date', 'date');
28 $table->index('ip', 'ip');
29 });
30 }
31
32 public function down(): void
33 {
34 Schema::dropIfExists('osu_logins');
35 }
36};