mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-24 11:15:56 +00:00
44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
class CreateSearchIndexTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('search_terms', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->string('term', 200);
|
|
$table->string('entity_type', 100);
|
|
$table->integer('entity_id');
|
|
$table->integer('score');
|
|
|
|
$table->index('term');
|
|
$table->index('entity_type');
|
|
$table->index(['entity_type', 'entity_id']);
|
|
$table->index('score');
|
|
});
|
|
|
|
// TODO - Drop old fulltext indexes
|
|
|
|
app(\BookStack\Services\SearchService::class)->indexAllEntities();
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('search_terms');
|
|
}
|
|
}
|