40 lines
840 B
PHP
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');
|
|
}
|
|
|
|
}
|