blue-twilight/database/migrations/2016_09_02_125912_create_photos_table.php

42 lines
1003 B
PHP
Raw Permalink Normal View History

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePhotosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('photos', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedInteger('album_id');
$table->string('name');
$table->string('description')->default('');
$table->string('file_name');
$table->string('mime_type');
$table->unsignedBigInteger('file_size');
$table->timestamps();
$table->foreign('album_id')
->references('id')->on('albums')
->onDelete('no action');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('photos');
}
}