You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Laravel (version X) and noticed a difference in behavior depending on the order in which I call ->index() and ->constrained() on a foreign ID column.
Example 1: This creates an index on main_activity_domain_id:
I would have expected both code snippets to create an index on the foreign key column. Is this an intentional difference, or might it be a bug in how Laravel processes these chained methods?
Thanks for taking a look!
Steps To Reproduce
Migrations
The text was updated successfully, but these errors were encountered:
Laravel Version
11
PHP Version
8.3
Database Driver & Version
SQLite
Description
Hello Laravel team,
I'm using Laravel (version X) and noticed a difference in behavior depending on the order in which I call ->index() and ->constrained() on a foreign ID column.
Example 1: This creates an index on main_activity_domain_id:
$table->foreignId('main_activity_domain_id')
->index()
->constrained()
->restrictOnDelete()
->restrictOnUpdate();
Example 2: This does not create an index on main_activity_domain_id:
$table->foreignId('main_activity_domain_id')
->constrained()
->index()
->restrictOnDelete()
->restrictOnUpdate();
I would have expected both code snippets to create an index on the foreign key column. Is this an intentional difference, or might it be a bug in how Laravel processes these chained methods?
Thanks for taking a look!
Steps To Reproduce
Migrations
The text was updated successfully, but these errors were encountered: