1
0
mirror of https://github.com/flarum/core.git synced 2025-05-31 11:39:56 +02:00
php-flarum/migrations/2015_02_24_000000_create_posts_table.php
2015-08-12 01:29:40 +02:00

51 lines
1.4 KiB
PHP

<?php
use Flarum\Install\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
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');
}
}