mirror of
https://github.com/flarum/core.git
synced 2025-10-09 22:16:51 +02:00
Implemented our own migration repository + migrator (based on Laravel's stuff) so that we can keep track of which migrations have been run for core and per-extension. That way we can simple call the migrator to upgrade core/extensions, and to uninstall extensions.
50 lines
1.3 KiB
PHP
50 lines
1.3 KiB
PHP
<?php
|
|
|
|
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');
|
|
}
|
|
}
|