laravel에서 테이블 '팀'과 '대회'를 만들려고하지만 migrate 명령을 실행할 때 다음과 같은 결과가 나옵니다. errno : 150 "외래 키 제약 조건이 잘못 구성되었습니다. "Laravel - 외래 키 제약 조건이 잘못 형성되었습니다
Schema::create('competitions', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('team_name');
$table->foreign('team_name')->references('name')->on('teams')->onDelete('cascade');
$table->timestamps();
});
Schema::create('teams', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('place');
$table->string('competition')->nullable();;
$table->foreign('competition')->references('name')->on('competitions')->onDelete('set null');
$table->timestamps();
});
아니요, 여전히 동일한 오류가 발생하지 않았습니다. – jordibenck