images/database/migrations/2017_10_03_140902_create_as...

39 lines
854 B
PHP
Executable File

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAssociateImages extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('associate_images', function (Blueprint $table) {
$table->integer('id', true);
$table->integer('image_id');
$table->string('relation_type');
$table->integer('relation_id');
$table->integer('position')->nullable();
$table->foreign('image_id')->references('id')->on('images')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('associate_images');
}
}