2015-12-05 23:11:48 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class FulltextWeighting extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2017-04-09 21:44:56 +08:00
|
|
|
$prefix = DB::getTablePrefix();
|
|
|
|
DB::statement("ALTER TABLE {$prefix}pages ADD FULLTEXT name_search(name)");
|
|
|
|
DB::statement("ALTER TABLE {$prefix}books ADD FULLTEXT name_search(name)");
|
|
|
|
DB::statement("ALTER TABLE {$prefix}chapters ADD FULLTEXT name_search(name)");
|
2015-12-05 23:11:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::table('pages', function(Blueprint $table) {
|
|
|
|
$table->dropIndex('name_search');
|
|
|
|
});
|
|
|
|
Schema::table('books', function(Blueprint $table) {
|
|
|
|
$table->dropIndex('name_search');
|
|
|
|
});
|
|
|
|
Schema::table('chapters', function(Blueprint $table) {
|
|
|
|
$table->dropIndex('name_search');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|