File: /home/armgroup/libs/database/migrations/2021_04_28_121655_create_categorizable_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCategorizableTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categorizables', function (Blueprint $table) {
$table->foreignId('category_id')->constrained('categories')->onUpdate('cascade')->onDelete('cascade');
$table->unsignedBigInteger('categorizable_id')->index();
$table->string('categorizable_type', 190)->index();
$table->boolean('is_main')->default(false);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('categorizable');
}
}