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

fix: migration broke in laravel v11.15 #224

Merged
merged 5 commits into from
Aug 7, 2024
Merged

Conversation

taka-oyama
Copy link
Collaborator

@taka-oyama taka-oyama commented Aug 5, 2024

Broke when laravel/framework#51373 was merged.

Summary by CodeRabbit

  • New Features
    • Updated the minimum supported version of Laravel to 11.15.0 for improved compatibility.
  • Bug Fixes
    • Resolved an issue where schema changes were applied twice, enhancing application functionality.
  • Documentation
    • Added a new entry in the CHANGELOG for version 8.2.0 to clarify updates and requirements.
    • Improved type hinting and documentation within the Model class for better developer experience.

@taka-oyama taka-oyama added the bug Something isn't working label Aug 5, 2024
@taka-oyama taka-oyama requested a review from a team August 5, 2024 08:36
@taka-oyama taka-oyama self-assigned this Aug 5, 2024
Copy link

coderabbitai bot commented Aug 5, 2024

Walkthrough

The recent changes introduce version 8.2.0, raising the minimum supported Laravel version to 11.15.0 and addressing a significant bug related to schema changes being applied multiple times. Improvements to the SQL compilation logic enhance both flexibility and efficiency. Additionally, a deprecation notice for the formatTimestampValue method warns developers of its planned removal in a future version. These updates collectively enhance compatibility and operational reliability.

Changes

Files Change Summary
CHANGELOG.md, composer.json Updated the minimum Laravel version to 11.15.0 in composer.json and added a new entry in the changelog for version 8.2.0, dated August 5, 2024.
src/Schema/Grammar.php Modified compileAdd and compileChange methods to return either a list of strings or a single string, streamlined SQL generation logic, and added a deprecation notice for formatTimestampValue.
src/Eloquent/Model.php Enhanced PHP docblocks in the Model class for improved type hinting and generics, clarifying relationships and return types in methods.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Application
    participant Database

    User->>Application: Request to change schema
    Application->>Database: Compile change request
    Database->>Application: Return compiled SQL
    Application->>User: Confirm change applied
Loading

🐇 In a world of code and design,
Where logic and functions intertwine,
We've hopped along with changes bright,
Fixes and updates, oh what a delight!
With Laravel's new version in sight,
Our application shines, oh what a height! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
CHANGELOG.md (1)

4-4: Fix repeated word.

There is a repeated word "Fixed" in the changelog entry.

- Fixed - Fixed an issue where Schema changes were applied twice. (#224)
+ - Fixed an issue where Schema changes were applied twice. (#224)
Tools
LanguageTool

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ...version is bumped to 11.15.0 for #224. Fixed - Fixed an issue where Schema changes were appl...

(ENGLISH_WORD_REPEAT_RULE)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 416faae and 434ff5a.

Files selected for processing (3)
  • CHANGELOG.md (1 hunks)
  • composer.json (1 hunks)
  • src/Schema/Grammar.php (2 hunks)
Additional context used
LanguageTool
CHANGELOG.md

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ...version is bumped to 11.15.0 for #224. Fixed - Fixed an issue where Schema changes were appl...

(ENGLISH_WORD_REPEAT_RULE)

Additional comments not posted (4)
composer.json (1)

14-14: LGTM! Version update for Laravel framework.

The version constraint for laravel/framework has been updated to ^11.15.0. This ensures compatibility with Laravel version 11.15.0 and above.

CHANGELOG.md (1)

1-6: LGTM! Changelog entry for version 8.2.0.

The changelog entry is clear and informative, detailing the minimum Laravel version requirement and a critical bug fix.

Tools
LanguageTool

[duplication] ~4-~4: Possible typo: you repeated a word
Context: ...version is bumped to 11.15.0 for #224. Fixed - Fixed an issue where Schema changes were appl...

(ENGLISH_WORD_REPEAT_RULE)

src/Schema/Grammar.php (2)

838-839: Deprecation notice is clear.

The deprecation notice for the formatTimestampValue method is clear and helpful for future developers.


134-146: LGTM! Changes to compileChange method.

The changes to the compileChange method improve flexibility and streamline SQL generation. The updated return type and logic are clear and efficient.

However, ensure that all usages of the compileChange method are compatible with the new return type.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
CHANGELOG.md (1)

3-3: Clarify the Note on Laravel Version

Consider rephrasing for a more formal tone.

- > [!NOTE] Minimum supported Laravel version is bumped to 11.15.0 for #224.
+ > [!NOTE] The minimum supported Laravel version has been increased to 11.15.0 for #224.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 434ff5a and a10b359.

Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • src/Schema/Grammar.php (3 hunks)
Additional context used
LanguageTool
CHANGELOG.md

[style] ~5-~5: Consider using a different verb for a more formal wording.
Context: ...rsion is bumped to 11.15.0 for #224. - Fixed an issue where Schema changes were appl...

(FIX_RESOLVE)

Additional comments not posted (7)
CHANGELOG.md (2)

1-1: Correct and Informative Version Entry

The version entry for 8.2.0 is correctly formatted and includes the date.


5-5: Clear and Concise Bug Fix Entry

The bug fix description is clear and concise.

Tools
LanguageTool

[style] ~5-~5: Consider using a different verb for a more formal wording.
Context: ...rsion is bumped to 11.15.0 for #224. - Fixed an issue where Schema changes were appl...

(FIX_RESOLVE)

src/Schema/Grammar.php (5)

118-118: Accurate Return Type Annotation

The return type annotation for compileAdd is accurate and enhances type safety.


122-130: Efficient SQL Generation in compileAdd

The updated logic for SQL generation in compileAdd is more efficient and readable.


139-139: Accurate Return Type Annotation

The return type annotation for compileChange is accurate and enhances type safety.


143-151: Efficient SQL Generation in compileChange

The updated logic for SQL generation in compileChange is more efficient and readable.


843-844: Deprecation Notice for formatTimestampValue

The deprecation notice for formatTimestampValue is clear and provides adequate warning for future changes.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between a10b359 and 8718e35.

Files selected for processing (1)
  • src/Eloquent/Model.php (3 hunks)
Additional comments not posted (3)
src/Eloquent/Model.php (3)

27-27: Improved type inference for static methods.

The @mixin Builder<static> annotation enhances type inference for static methods, improving autocompletion and type checking.


45-45: Enhanced type safety for resolveRouteBindingQuery method.

The parameter type hint now specifies that the Relation type is parameterized, improving type safety and understanding of what types can be passed to this method.


62-62: Improved return type for resolveChildRouteBindingQuery method.

The return type now provides more detailed information about the type of Relation being returned, enhancing type safety and preventing type-related errors.

Copy link
Contributor

@zeriyoshi zeriyoshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@taka-oyama taka-oyama merged commit da20e47 into master Aug 7, 2024
1 check passed
@taka-oyama taka-oyama deleted the fix/broken-schema-change branch August 7, 2024 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants