osb/database/migrations/2017_06_18_104531_create_ab_pivot_product_cat_table.php
2018-06-18 21:18:34 +10:00

40 lines
840 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'], 'UNIQUE');
$table->index(['product_cat_id','site_id'], 'fk_pc_idx');
$table->index(['product_id','site_id'], 'fk_p_idx');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('ab_pivot_product_cat');
}
}