Consider foreign key constraints with isRelationNullable (#1231)

* Consider foreign key constraints with isRelationNullable

* test: add belongsTo Variation

* command: composer test-regenerate
This commit is contained in:
atsu.kg
2021-08-07 13:31:20 +02:00
committed by GitHub
parent b268871c16
commit 52a4b64656
4 changed files with 134 additions and 3 deletions
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class BelongsToVariationTable extends Migration
{
public function up(): void
{
Schema::create('belongs_to_variations', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('not_null_column_with_foreign_key_constraint');
$table->integer('not_null_column_with_no_foreign_key_constraint');
$table->integer('nullable_column_with_foreign_key_constraint')->nullable();
$table->integer('nullable_column_with_no_foreign_key_constraint')->nullable();
$table->foreign('not_null_column_with_foreign_key_constraint')->references('id')->on('belongs_to_variations');
$table->foreign('nullable_column_with_foreign_key_constraint')->references('id')->on('belongs_to_variations');
});
}
}