Schema::create(self::TABLE_NAME, function (Blueprint $table): void {
$table->id();
$table->bigInteger('relationable_id')->unsigned();
$table->string('relationable_type');
$table->bigInteger('target_id')->unsigned();
$table->string('target_type');
$table->string('relation_type', 45);
$table->timestamps();
$table->index('relation_type');
$table->unique(['relationable_id', 'relationable_type', 'target_type', 'relation_type'], self::TABLE_NAME . '_unique');
});
Schema::create(self::TABLE_NAME, function (Blueprint $table): void {
$table->id();
$table->bigInteger('relationable_id')->unsigned();
$table->string('relationable_type');
$table->bigInteger('target_id')->unsigned();
$table->string('target_type');
$table->string('relation_type', 45);
$table->timestamps();
$table->index('relation_type');
$table->unique(['relationable_id', 'relationable_type', 'target_type', 'relation_type'], self::TABLE_NAME . '_unique');
});