Schema::create('products', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->unsignedInteger('parent_product_id')->nullable(); //foreign key to self
});
Schema::create('products_closure', function (Blueprint $table) {
$table->unsignedInteger('ancestor');
$table->unsignedInteger('descendant');
$table->unsignedTinyInteger('distance');
$table->primary(['ancestor', 'descendant']);
});
Schema::create('products', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->unsignedInteger('parent_product_id')->nullable(); //foreign key to self
});
Schema::create('products_closure', function (Blueprint $table) {
$table->unsignedInteger('ancestor');
$table->unsignedInteger('descendant');
$table->unsignedTinyInteger('distance');
$table->primary(['ancestor', 'descendant']);
});