Я пытаюсь создать ФК между буксирными столами.Вот мои миграции:
public function up()
{
Schema::create('contracts', function (Blueprint $table) {
$table->increments('id');
// Some other cols removed for this post
$table->string('user_file_path');
$table->timestamps();
$table->foreign('user_file_path')->references('path')->on('user_files');
});
}
и
public function up()
{
Schema::create('user_files', function (Blueprint $table) {
$table->increments('id');
$table->integer('application_id')->unsigned();
$table->string('random', 32);
$table->string('path');
$table->timestamps();
$table->foreign('application_id')->references('id')->on('applications');
});
}
Я получаю эту ошибку после запуска php artisan migrate
General error: 1005 Can't create table 'dashboard'.'#sql-1890_b6' (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table 'contracts' add constraint 'contracts_user_file_path_foreign' foreign key ('user_file_path') references 'user_files' ('path'))
Что я делаю не так?