<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateEntriesTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('entries', function (Blueprint $table) { $table->increments('id'); $table->string('title', 355); $table->string('slug'); $table->text('body'); $table->integer('status')->default(1); $table->string('cover', 455)->nullable(); $table->string('tags', 800); $table->date('publication_date')->nullable(); $table->bigInteger('views')->default(0); $table->integer('user_id')->unsigned(); $table->foreign('user_id') ->references('id') ->on('users') ->onDelete('cascade'); $table->integer('category_id')->unsigned(); $table->foreign('category_id') ->references('id') ->on('entry_categories') ->onDelete('cascade'); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('entries'); } }