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

31 lines
962 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');
$table->string('"title')->index();
$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');
}
}