Laravel Migration $table->foreignIdFor() identifier name is too long. Anyone know how to add a custom name?
I did some research and it seams there is no possibility to set the identifier name with the foreignIdFor
or foreignId
method.
As a workaround you can add the foreign key manually like this:
$table->unsignedBigInteger('shared_accounts_environment_id');
$table->foreign('shared_accounts_environment_id', 'custom_identifier_name')->references('id')->on('shared_accounts_environments');
I have found an issue report about this in the laravel github repo: https://github.com/laravel/framework/issues/44947