the browser-facing portion of osu!
1<?php
2
3/**
4 * This file is part of OAuth 2.0 Laravel.
5 *
6 * (c) Luca Degasperi <packages@lucadegasperi.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12use Illuminate\Database\Migrations\Migration;
13use Illuminate\Database\Schema\Blueprint;
14use Illuminate\Support\Facades\Schema;
15
16/**
17 * This is the create oauth sessions table migration class.
18 *
19 * @author Luca Degasperi <packages@lucadegasperi.com>
20 */
21return new class extends Migration
22{
23 /**
24 * Run the migrations.
25 *
26 * @return void
27 */
28 public function up()
29 {
30 Schema::create('oauth_sessions', function (Blueprint $table) {
31 $table->increments('id');
32 $table->string('client_id', 40);
33 $table->enum('owner_type', ['client', 'user'])->default('user');
34 $table->string('owner_id');
35 $table->string('client_redirect_uri')->nullable();
36 $table->timestamps();
37
38 $table->index(['client_id', 'owner_type', 'owner_id']);
39
40 $table->foreign('client_id')
41 ->references('id')->on('oauth_clients')
42 ->onDelete('cascade')
43 ->onUpdate('cascade');
44 });
45 }
46
47 /**
48 * Reverse the migrations.
49 *
50 * @return void
51 */
52 public function down()
53 {
54 Schema::table('oauth_sessions', function (Blueprint $table) {
55 $table->dropForeign('oauth_sessions_client_id_foreign');
56 });
57 Schema::drop('oauth_sessions');
58 }
59};