laravel-learn-bbs/database/migrations/2017_12_31_131710_create_topics_table.php

31 lines
961 B
PHP
Raw Normal View History

2018-01-01 04:00:45 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateTopicsTable extends Migration
{
public function up()
{
Schema::create('topics', function (Blueprint $table) {
$table->increments('id');
2018-01-15 15:24:11 +00:00
$table->string('title')->index();
2018-01-01 04:00:45 +00:00
$table->text('body');
$table->integer('user_id')->unsigned()->index();
$table->integer('category_id')->unsigned()->index();
$table->integer('reply_count')->unsigned()->default(0);
$table->integer('view_count')->unsigned()->default(0);
$table->integer('last_reply_user_id')->unsigned()->default(0);
$table->integer('order')->unsigned()->default(0);
$table->text('excerpt');
$table->string('slug')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::drop('topics');
}
}