Skip to content

Commit 473d988

Browse files
Merge pull request #3 from JohnnyMaynne/add_index
Add index to morphs
2 parents b03c0da + 98ee770 commit 473d988

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
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+
};

src/FilamentCommentsServiceProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ protected function getMigrations(): array
8585
{
8686
return [
8787
'create_filament_comments_table',
88+
'add_index_to_subject',
8889
];
8990
}
9091
}

0 commit comments

Comments
 (0)