<?php
 use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateDoc extends Migration { public function up() { Schema::create('doc', function (Blueprint $table) { $table->increments('id'); $table->timestamps(); $table->string('alias', 20)->nullable()->comment('别名'); $table->integer('memberUserId')->nullable()->comment('用户ID'); $table->integer('bookId')->nullable()->comment('BookId'); $table->string('title', 100)->nullable()->comment('标题'); $table->string('summary', 200)->nullable()->comment('摘要'); $table->tinyInteger('visit')->nullable()->comment('访问控制'); $table->string('visitPassword', 20)->nullable()->comment('访问控制密码'); $table->text('content')->nullable()->comment('内容'); $table->index(['memberUserId']); $table->index(['bookId']); $table->unique(['alias']); }); } public function down() { } } 