osb/database/migrations/2017_06_18_104531_create_ab_pivot_product_cat_table.php

40 lines
805 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateAbPivotProductCatTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ab_pivot_product_cat', function(Blueprint $table)
{
$table->bigInteger('id', false);
$table->integer('site_id');
$table->bigInteger('product_id')->nullable();
$table->integer('product_cat_id')->nullable();
$table->primary(['id','site_id']);
$table->unique(['site_id','product_id','product_cat_id']);
$table->index(['product_cat_id','site_id']);
$table->index(['product_id','site_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ab_pivot_product_cat');
}
}