Skip to content

Commit 707bc4b

Browse files
Johnny MaynneJohnny Maynne
authored andcommitted
add migration
1 parent c247704 commit 707bc4b

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
public function up(): void
10+
{
11+
Schema::table('filament_comments', function (Blueprint $table) {
12+
$table->index(['subject_type', 'subject_id']);
13+
});
14+
}
15+
16+
public function down(): void
17+
{
18+
Schema::table('filament_comments', function (Blueprint $table) {
19+
$table->dropIndex(['subject_type', 'subject_id']);
20+
});
21+
}
22+
};

database/migrations/create_filament_comments_table.php.stub

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ return new class extends Migration
1111
Schema::create('filament_comments', function (Blueprint $table) {
1212
$table->id();
1313
$table->unsignedBigInteger('user_id');
14-
$table->morphs('subject');
14+
$table->string('subject_type');
15+
$table->unsignedBigInteger('subject_id');
1516
$table->longText('comment');
1617
$table->timestamps();
1718
$table->softDeletes();

0 commit comments

Comments
 (0)