Skip to content

Conversation

@granitibrahimi
Copy link
Contributor

When constrained() is used after foreignIdFor() then on the migration query for the constrained instead of the table name uses column name and pluralise it.

$table->foreignIdFor(User::class, 'assigned_at')->nullable()->constrained();

Query produced to add the constrain:

alter table `tasks` add constraint `tasks_assigned_at_foreign` foreign key (`assigned_at`) references `assigned_ats` (`id`);

so instead of references users it produces references assigned_ats pluralised name of the column.

@granitibrahimi granitibrahimi marked this pull request as draft October 13, 2024 17:00
@granitibrahimi granitibrahimi marked this pull request as ready for review October 13, 2024 22:15
@taylorotwell taylorotwell merged commit f69a736 into laravel:11.x Oct 15, 2024
31 checks passed
@morloderex
Copy link
Contributor

This pr broke our migrations.

@crynobone
Copy link
Member

This pr broke our migrations.

Can you submit a bug report with reproducing code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants