/** * Run the migrations. * * @return void */ public function up() { // DB::statement('CREATE VIRTUAL TABLE items_fts USING fts3(item_id, words);'); $items = Item::get(); foreach ($items as $item) { $fts = new ItemFts(); $fts->item_id = $item->id; $fts->words = FtsUtils::toNgram($item->title . "\n\n" . $item->body); $fts->save(); } }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('items_history', function ($table) { $table->increments('id'); $table->integer('item_id'); $table->string('open_item_id', 20); $table->integer('user_id'); $table->string('title', 255); $table->text('body'); $table->integer('published')->default(0); $table->timestamps(); }); $items = Item::all(); foreach ($items as $item) { $this->createPastHistory($item); } }