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

feat: IDENTITY column support #243

Merged
merged 4 commits into from
Dec 18, 2024
Merged

feat: IDENTITY column support #243

merged 4 commits into from
Dec 18, 2024

Conversation

taka-oyama
Copy link
Collaborator

@taka-oyama taka-oyama commented Dec 16, 2024

No description provided.

@taka-oyama taka-oyama added enhancement New feature or request waiting for review labels Dec 16, 2024
@taka-oyama taka-oyama requested a review from a team December 16, 2024 09:30
@taka-oyama taka-oyama self-assigned this Dec 16, 2024
Copy link

coderabbitai bot commented Dec 16, 2024

Walkthrough

This pull request introduces several enhancements to the database schema and query builder functionality. Version 8.3.0 of the library adds support for IDENTITY columns, invisible columns, change streams using Blueprint, and snapshot queries. The changes include updating the changelog, modifying the Docker emulator version, and extending the schema definition capabilities. The PR also introduces new methods for query building, updates commit option configurations, and deprecates certain existing methods.

Changes

File Change Summary
CHANGELOG.md - Added support for IDENTITY columns, invisible columns, change streams, and snapshot queries
- Deprecated Connection::getDatabaseContext()
- Added Query\Builder::whereNotInUnnest(...)
- Updated Query\Builder::whereIn behavior
compose.yaml Updated Docker emulator image from 1.5.23 to 1.5.28
src/Schema/ColumnDefinition.php Added generatedAs property with support for string, Expression, true, or null values
src/Schema/Grammar.php - Updated $modifiers array
- Added modifyGeneratedAs() method for handling identity column modifiers
tests/Schema/BlueprintTest.php - Added tests for generated columns and sequences
- Updated test_default_values() method
- Added new test methods for sequence operations
phpstan.neon Removed specific error message from ignoreErrors related to strict comparison
- Added new error message regarding method return type

Suggested reviewers

  • Uyan712

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ebd5c9 and 2241668.

📒 Files selected for processing (1)
  • phpstan.neon (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • phpstan.neon

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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: 1

🧹 Nitpick comments (1)
tests/Schema/BlueprintTest.php (1)

779-780: Enhance tests to verify generated identity column values

Currently, the assertions check that 'int_gen' and 'int_genc' are integers. It would be beneficial to assert that the values meet specific criteria, such as being positive integers or following the expected sequence pattern, to ensure that the identity columns function correctly.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f3d950b and 0c0b17d.

📒 Files selected for processing (5)
  • CHANGELOG.md (1 hunks)
  • compose.yaml (1 hunks)
  • src/Schema/ColumnDefinition.php (2 hunks)
  • src/Schema/Grammar.php (2 hunks)
  • tests/Schema/BlueprintTest.php (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • compose.yaml
🔇 Additional comments (6)
tests/Schema/BlueprintTest.php (1)

738-739: ⚠️ Potential issue

Invalid SQL syntax in generated identity column definitions

The SQL statements for the columns 'int_gen' and 'int_genc' may contain syntax errors. The fragment 'generated by default as identity (bit_reversed_positive start counter with 2)' might not be valid. Consider verifying the correct syntax for identity columns in SQL and updating the generated statements.

Run the following script to check the correct SQL syntax for identity columns:

src/Schema/ColumnDefinition.php (2)

23-23: Appropriate import of Expression class

The addition of use Illuminate\Database\Query\Expression; is necessary for handling the generatedAs property, which can be of type Expression.


37-37: Correctly added generatedAs property to PHPDoc

The @property string|Expression|true|null $generatedAs annotation accurately documents the new generatedAs property, enhancing clarity and code documentation.

CHANGELOG.md (1)

3-3: Changelog updated accurately for version 8.3.0

The changelog entries properly reflect the new features, enhancements, and deprecations introduced in version 8.3.0, providing a clear overview of the changes.

src/Schema/Grammar.php (2)

41-41: Verify modifier order in $modifiers array

With the addition of 'GeneratedAs' to the $modifiers array, please ensure that the order of modifiers correctly reflects the intended sequence for SQL generation, as the order may affect how modifiers are applied.


736-759: ⚠️ Potential issue

Ensure compatibility of match expression with PHP version

The use of the match expression in the modifyGeneratedAs method requires PHP 8.0 or higher. Please confirm that the project's minimum PHP version requirement is PHP 8.0 or above to prevent potential syntax errors.

Run the following script to check the project's minimum PHP version requirement:

✅ Verification successful

match expression usage is compatible with PHP requirements

The codebase requires PHP 8.2 or higher (^8.2) as specified in composer.json, which fully supports the match expression introduced in PHP 8.0. The code is safe to use as is.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check the minimum PHP version requirement in composer.json.

# Expected: The 'php' requirement is '>=8.0.0' or higher.

jq '.require.php' composer.json

Length of output: 38

tests/Schema/BlueprintTest.php Show resolved Hide resolved
@taka-oyama taka-oyama merged commit 0d6df00 into master Dec 18, 2024
1 check passed
@taka-oyama taka-oyama deleted the feature/identity-columns branch December 18, 2024 03:04
@coderabbitai coderabbitai bot mentioned this pull request Dec 24, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants