]> BookStack Code Mirror - bookstack/blob - database/migrations/2015_08_31_175240_add_search_indexes.php
99e5a28f08d797ac294b485f1b0cc13e1dbeb897
[bookstack] / database / migrations / 2015_08_31_175240_add_search_indexes.php
1 <?php
2
3 use Illuminate\Database\Schema\Blueprint;
4 use Illuminate\Database\Migrations\Migration;
5
6 class AddSearchIndexes extends Migration
7 {
8     /**
9      * Run the migrations.
10      *
11      * @return void
12      */
13     public function up()
14     {
15         DB::statement('ALTER TABLE pages ADD FULLTEXT search(name, text)');
16         DB::statement('ALTER TABLE books ADD FULLTEXT search(name, description)');
17         DB::statement('ALTER TABLE chapters ADD FULLTEXT search(name, description)');
18     }
19
20     /**
21      * Reverse the migrations.
22      *
23      * @return void
24      */
25     public function down()
26     {
27         Schema::table('pages', function(Blueprint $table) {
28             $table->dropIndex('search');
29         });
30         Schema::table('books', function(Blueprint $table) {
31             $table->dropIndex('search');
32         });
33         Schema::table('chapters', function(Blueprint $table) {
34             $table->dropIndex('search');
35         });
36     }
37 }