]> BookStack Code Mirror - bookstack/blob - database/migrations/2015_12_05_145049_fulltext_weighting.php
Added search name weighting. Closes #27.
[bookstack] / database / migrations / 2015_12_05_145049_fulltext_weighting.php
1 <?php
2
3 use Illuminate\Database\Schema\Blueprint;
4 use Illuminate\Database\Migrations\Migration;
5
6 class FulltextWeighting 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 name_search(name)');
16         DB::statement('ALTER TABLE books ADD FULLTEXT name_search(name)');
17         DB::statement('ALTER TABLE chapters ADD FULLTEXT name_search(name)');
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('name_search');
29         });
30         Schema::table('books', function(Blueprint $table) {
31             $table->dropIndex('name_search');
32         });
33         Schema::table('chapters', function(Blueprint $table) {
34             $table->dropIndex('name_search');
35         });
36     }
37 }