Created
April 5, 2018 17:23
-
-
Save iboved/ef1be04d51299ee1d84de21336539eea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace BusyRoomsCMS\MediaManager\Updates; | |
use Schema; | |
use October\Rain\Database\Schema\Blueprint; | |
use October\Rain\Database\Updates\Migration; | |
class CreateImageableTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('imageables', function(Blueprint $table) { | |
$table->engine = 'InnoDB'; | |
$table->increments('id'); | |
$table->integer('image_id')->unsigned(); | |
$table->integer('imageable_id')->unsigned()->nullable(); | |
$table->string('imageable_type')->nullable(); | |
$table->integer('sort_order')->default(0); | |
$table->integer('created_by')->unsigned()->nullable(); | |
$table->integer('updated_by')->unsigned()->nullable(); | |
$table->timestamp('created_at')->nullable(); | |
$table->timestamp('updated_at')->nullable(); | |
$table->foreign('created_by')->references('id')->on('backend_users')->onDelete('set null'); | |
$table->foreign('updated_by')->references('id')->on('backend_users')->onDelete('set null'); | |
$table->foreign('image_id')->references('id')->on('busyroomscms_mediamanager_images')->onDelete('cascade'); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('imageables'); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace BusyRoomsCMS\MediaManager\Updates; | |
use Schema; | |
use October\Rain\Database\Schema\Blueprint; | |
use October\Rain\Database\Updates\Migration; | |
class CreateImageableTable extends Migration | |
{ | |
public function up() | |
{ | |
Schema::create('imageables', function(Blueprint $table) { | |
$table->engine = 'InnoDB'; | |
$table->increments('id'); | |
$table->integer('image_id'); | |
$table->integer('imageable_id'); | |
$table->string('imageable_type'); | |
$table->integer('sort_order')->nullable(); | |
$table->integer('created_by')->nullable(); | |
$table->integer('updated_by')->nullable(); | |
$table->integer('deleted_by')->nullable(); | |
$table->timestamp('created_at')->nullable(); | |
$table->timestamp('updated_at')->nullable(); | |
$table->timestamp('deleted_at')->nullable(); | |
}); | |
} | |
public function down() | |
{ | |
Schema::dropIfExists('imageables'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment