Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use foreignId for consistency #653

Merged
merged 1 commit into from
Nov 24, 2023
Merged

Use foreignId for consistency #653

merged 1 commit into from
Nov 24, 2023

Conversation

jasonmccreary
Copy link
Collaborator

@jasonmccreary jasonmccreary commented Nov 24, 2023

It seems recent code uses foreignId when setting the column data type for many and polymorphic relationship foreign keys. However, the standard belongsTo relationship still uses unsignedBigInteger as the data type. For consistency within Blueprint and to align with whatever data type Laravel uses for "id" columns foreignId is now used.

Given the following draft file:

models:
    Post:
        author_id: id

Before:

Schema::create('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('author_id');
}

After:

Schema::create('posts', function (Blueprint $table) {
    $table->foreignId('author_id');
}

@jasonmccreary jasonmccreary merged commit 46a2db9 into master Nov 24, 2023
8 checks passed
@jasonmccreary jasonmccreary deleted the modernize branch November 24, 2023 01:47
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.

1 participant