Skip to content

Conversation

@abnegate
Copy link
Member

@abnegate abnegate commented Aug 11, 2025

…ysql"

This reverts commit 83278d6, reversing changes made to eb2f759.

Summary by CodeRabbit

  • New Features
    • Enabled index array support for MySQL and MariaDB adapters, allowing creation and use of array-based indexes.
    • Related cast-index array behavior now reflects the enabled index array support in MySQL.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Walkthrough

Enable index array support by changing getSupportForIndexArray() to return true in both MySQL and MariaDB adapters. Removed outdated inline comments. No method signatures or other logic modified.

Changes

Cohort / File(s) Change Summary
Adapter index-array support flags
src/Database/Adapter/MySQL.php, src/Database/Adapter/MariaDB.php
Flip getSupportForIndexArray() return value from false to true; remove disabling comments. Dependent logic (e.g., getSupportForCastIndexArray() in MySQL relying on this) will now reflect enabled support. No other changes.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Database
    participant Adapter (MySQL/MariaDB)

    Client->>Database: createIndex(fields with array type)
    Database->>Adapter (MySQL/MariaDB): getSupportForIndexArray()
    Adapter (MySQL/MariaDB)-->>Database: true
    Database->>Database: proceed with array index validation/creation
    Database-->>Client: index created (arrays supported)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

A rabbit taps keys in a burrow so bright,
Flipping a flag from shadow to light.
Arrays now index, hop-hop—no fear!
MySQL, MariaDB lend a fuzzy ear.
With tidy returns and comments pruned,
The data fields dance—thump-thump, in tune. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-arrayindex

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
  • 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 explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this 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.

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.

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.

@abnegate abnegate merged commit 61dd323 into main Aug 11, 2025
14 of 15 checks passed
@abnegate abnegate deleted the revert-arrayindex branch August 11, 2025 09:02
Copy link
Contributor

@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

🧹 Nitpick comments (1)
src/Database/Adapter/MariaDB.php (1)

2002-2005: Re‐enable MariaDB array indexes: CAST unsupported, fallback and composite‐index behavior must be verified

Based on our inspection, MariaDB’s adapter currently:

  • Inherits SQL::getSupportForCastIndexArray() (returns false) → the CAST(... AS CHAR(N) ARRAY) path is never taken.
  • Overrides getSupportForIndexArray() to return true → array‐indexing will fall back to the non‐CAST path.

Please confirm the following before shipping:

• Fallback path for array indexes
– Ensure the code that generates a JSON/TEXT index applies a safe, fixed prefix length (using Database::ARRAY_INDEX_LENGTH) or uses generated columns. Without a length, indexing TEXT/JSON will fail in MariaDB.
– If no reliable fallback exists, override getSupportForIndexArray() in MariaDB to return false.

• Composite indexes in shared-tables mode
– We unconditionally prepend _tenant to every index. Verify that MariaDB allows a composite functional (JSON/TEXT) index alongside a normal column. If it doesn’t, skip the tenant prefix for array‐index definitions.

Suggested actions (pick one or both):

  • Explicitly override getSupportForIndexArray() → return false in MariaDB until proper CAST or fallback logic is implemented.
  • Enhance the MariaDB adapter’s fallback path to enforce prefix lengths or generated‐column indexing, and adjust shared-tables logic to omit _tenant for composite array indexes.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 39c6140 and cc10b50.

📒 Files selected for processing (2)
  • src/Database/Adapter/MariaDB.php (1 hunks)
  • src/Database/Adapter/MySQL.php (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Adapter Tests (SharedTables/Postgres)
  • GitHub Check: Adapter Tests (Mirror)
  • GitHub Check: Adapter Tests (MySQL)
  • GitHub Check: Adapter Tests (SharedTables/MariaDB)
  • GitHub Check: Adapter Tests (Pool)
  • GitHub Check: Adapter Tests (Postgres)
  • GitHub Check: Adapter Tests (SharedTables/MySQL)
  • GitHub Check: Adapter Tests (MariaDB)
🔇 Additional comments (1)
src/Database/Adapter/MySQL.php (1)

81-87: MySQL array indexes re-enabled: ensure safe 8.0.x version and composite MVI support

Please complete these checks before merging:

  • Confirm your CI/production MySQL is ≥ 8.0.29 (ideally a recent GA such as 8.0.43+) so that the original “composite + MVI wrong results” bug (108640) and later regressions are all fixed.
  • Composite indexes may include one multi-valued key part alongside other columns in any position—so prepending _tenant is safe and does not need to be skipped for MVI indexes.
  • Verify no index definitions inadvertently include more than one MVI part, as only a single CAST(... ARRAY) key part is permitted per index.

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.

2 participants