Feuerwehr-eppingen/database/migrations/2017_12_25_211800_create_document_table.php

39 lines
906 B
PHP
Executable File

<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateDocumentTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('documents', function (Blueprint $table) {
$table->increments('id');
$table->string('original_name');
$table->string('filename');
$table->string('mime_type')->index();
$table->string('model')->index();
$table->boolean('is_preview' )->default(false)->index();
$table->integer('model_id')->unsigned()->nullable();
$table->foreign('model_id')->references('id')->on('posts');
$table->integer('user_id')->unsigned()->nullable();
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('documents');
}
}