Skip to content

Commit

Permalink
chore: add foreign key to GameData.ForumTopicID (#2358)
Browse files Browse the repository at this point in the history
  • Loading branch information
wescopeland authored Apr 18, 2024
1 parent a0558f2 commit eddab13
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

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
{
Schema::table('GameData', function (Blueprint $table) {
$table->unsignedBigInteger('ForumTopicID')->change();
});

Schema::table('GameData', function (Blueprint $table) {
$table->foreign('ForumTopicID')->references('ID')->on('ForumTopic')->onDelete('set null');
});
}

public function down(): void
{
Schema::table('GameData', function (Blueprint $table) {
$table->dropForeign(['ForumTopicID']);
});

Schema::table('GameData', function (Blueprint $table) {
$table->integer('ForumTopicID')->change();
});
}
};

0 comments on commit eddab13

Please sign in to comment.