Files
monica/database/migrations/2018_09_23_024528_add_documents_table.php
T

32 lines
1.0 KiB
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddDocumentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('documents', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('account_id');
$table->unsignedInteger('contact_id');
$table->string('original_filename');
$table->string('new_filename');
$table->integer('filesize')->nullable();
$table->string('type')->nullable();
$table->string('mime_type')->nullable();
$table->integer('number_of_downloads')->default(0);
$table->timestamps();
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$table->foreign('contact_id')->references('id')->on('contacts')->onDelete('cascade');
});
}
}