Skip to content

Conversation

@abnegate
Copy link
Member

@abnegate abnegate commented Feb 3, 2026

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved validation for text field types in database operations, ensuring proper size enforcement for variable-character fields while appropriately handling other text field variants.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 3, 2026

📝 Walkthrough

Walkthrough

The change enhances the updateAttribute method in the Database class by introducing size validation for VARCHAR columns while excluding TEXT, MEDIUMTEXT, and LONGTEXT from size constraints. The method's type validation now explicitly recognizes these four text-based column types.

Changes

Cohort / File(s) Summary
Database Attribute Validation
src/Database/Database.php
Added size validation enforcement for VARCHAR data type against maxVarcharLength, while TEXT, MEDIUMTEXT, and LONGTEXT bypass size validation. Extended type validation to explicitly recognize VARCHAR, TEXT, MEDIUMTEXT, and LONGTEXT as valid scalar attribute types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through column rows,
VARCHAR sizes now it knows!
TEXT flows free without a care,
Validation logic, strong and fair! 🐰✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding VARCHAR, TEXT, MEDIUMTEXT, and LONGTEXT to validation in the updateAttribute method.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-string-updates

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

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🤖 Fix all issues with AI agents
In `@src/Database/Database.php`:
- Around line 2669-2684: The TEXT branch currently skips validation but leaves a
prior or supplied $size intact, causing stale metadata; in the case handling
self::VAR_TEXT, self::VAR_MEDIUMTEXT, and self::VAR_LONGTEXT ensure $size is
normalized (e.g., set to null/zero or rejected) before continuing so it cannot
be persisted or used for width/index checks—update the switch branch in the
method where $size is inspected (the case blocks for self::VAR_TEXT /
VAR_MEDIUMTEXT / VAR_LONGTEXT) to either assign a normalized value to $size or
throw a DatabaseException when a non-empty size is provided, so downstream logic
never sees a leftover VARCHAR size.

@abnegate abnegate merged commit 2783f07 into main Feb 3, 2026
18 checks passed
@abnegate abnegate deleted the fix-string-updates branch February 3, 2026 10:31
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