Forked from mattaebersold/gist:bd9011f0d830e29dddb3
Last active
August 29, 2015 14:24
-
-
Save weotch/d564670de3d2edd866dd to your computer and use it in GitHub Desktop.
This file contains 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 | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class ProductImagesTable extends Migration { | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
Schema::create('product_images', function($t){ | |
$t->increments('id'); | |
$t->integer('product_id')->unsigned(); | |
$t->string('title'); | |
$t->string('image')->nullable(); | |
$t->string('image_crops')->nullable(); | |
$t->integer('position'); | |
$t->boolean('visible')->nullable()->index(); | |
$t->timestamps(); | |
$t->index(['position', 'created_at']); | |
$t->foreign('product_id')->references('id')->on('products')->onUpdate('cascade')->onDelete('cascade'); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
// | |
Schema::drop('product_images'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment