Skip to content

[9.x] Added dropForeignIdFor method to match foreignIdFor method#40950

Merged
taylorotwell merged 5 commits into
laravel:9.xfrom
bretto36:foreign-key-drop
Feb 12, 2022
Merged

[9.x] Added dropForeignIdFor method to match foreignIdFor method#40950
taylorotwell merged 5 commits into
laravel:9.xfrom
bretto36:foreign-key-drop

Conversation

@bretto36

@bretto36 bretto36 commented Feb 11, 2022

Copy link
Copy Markdown
Contributor

Hi All

So i recently started using these foreignIdFor methods to make my migrations look so much nicer. But i found that the down() method of the migration didn't look as nice

Currently i'm writing

$table->foreignIdFor(\App\Models\Item::class);

and then to drop

$table->dropForeign('item_id')

This change introduces

$table->dropForeignIdFor(\App\Models\Item::class);

And also the constrained scenario

$table->foreignIdFor(\App\Models\Item::class)->constrained();

This change introduces

$table->dropConstrainedForeignIdFor(\App\Models\Item::class);

@driesvints driesvints changed the title Added dropForeignIdFor method to match foreignIdFor method [9.x] Added dropForeignIdFor method to match foreignIdFor method Feb 11, 2022
@driesvints

Copy link
Copy Markdown
Member

@bretto36 I believe the handling of $column in dropForeignIdFor is incorrect here. Please see #43753

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.

3 participants