mirror of
https://github.com/flarum/core.git
synced 2025-02-25 19:53:48 +01:00
58 lines
1.5 KiB
PHP
58 lines
1.5 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Flarum.
|
|
*
|
|
* (c) Toby Zerner <toby.zerner@gmail.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
use Flarum\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
class CreatePostsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
$this->schema->create('posts', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->integer('discussion_id')->unsigned();
|
|
$table->integer('number')->unsigned()->nullable();
|
|
|
|
$table->dateTime('time');
|
|
$table->integer('user_id')->unsigned()->nullable();
|
|
$table->string('type', 100)->nullable();
|
|
$table->text('content')->nullable();
|
|
|
|
$table->dateTime('edit_time')->nullable();
|
|
$table->integer('edit_user_id')->unsigned()->nullable();
|
|
$table->dateTime('hide_time')->nullable();
|
|
$table->integer('hide_user_id')->unsigned()->nullable();
|
|
|
|
$table->unique(['discussion_id', 'number']);
|
|
|
|
$table->engine = 'MyISAM';
|
|
});
|
|
|
|
$prefix = $this->schema->getConnection()->getTablePrefix();
|
|
$this->schema->getConnection()->statement('ALTER TABLE '.$prefix.'posts ADD FULLTEXT content (content)');
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
$this->schema->drop('posts');
|
|
}
|
|
}
|