3 use Illuminate\Database\Migrations\Migration;
4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Support\Facades\Schema;
7 return new class extends Migration
14 // This was removed for v0.24 since these indexes are removed anyway
15 // and will cause issues for db engines that don't support such indexes.
17 // $prefix = DB::getTablePrefix();
18 // DB::statement("ALTER TABLE {$prefix}pages ADD FULLTEXT search(name, text)");
19 // DB::statement("ALTER TABLE {$prefix}books ADD FULLTEXT search(name, description)");
20 // DB::statement("ALTER TABLE {$prefix}chapters ADD FULLTEXT search(name, description)");
24 * Reverse the migrations.
26 public function down(): void
28 $sm = Schema::getConnection()->getDoctrineSchemaManager();
29 $pages = $sm->listTableDetails('pages');
30 $books = $sm->listTableDetails('books');
31 $chapters = $sm->listTableDetails('chapters');
33 if ($pages->hasIndex('search')) {
34 Schema::table('pages', function (Blueprint $table) {
35 $table->dropIndex('search');
39 if ($books->hasIndex('search')) {
40 Schema::table('books', function (Blueprint $table) {
41 $table->dropIndex('search');
45 if ($chapters->hasIndex('search')) {
46 Schema::table('chapters', function (Blueprint $table) {
47 $table->dropIndex('search');