Skip to content

Commit

Permalink
Merge pull request #3 from JohnnyMaynne/add_index
Browse files Browse the repository at this point in the history
Add index to morphs
  • Loading branch information
luke-parallax authored Feb 13, 2024
2 parents b03c0da + 98ee770 commit 473d988
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions database/migrations/add_index_to_subject.php.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

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('filament_comments', function (Blueprint $table) {
$table->index(['subject_type', 'subject_id']);
});
}

public function down(): void
{
Schema::table('filament_comments', function (Blueprint $table) {
$table->dropIndex(['subject_type', 'subject_id']);
});
}
};
1 change: 1 addition & 0 deletions src/FilamentCommentsServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ protected function getMigrations(): array
{
return [
'create_filament_comments_table',
'add_index_to_subject',
];
}
}

0 comments on commit 473d988

Please sign in to comment.