Skip to content

Text attributes#148

Merged
abnegate merged 5 commits intomainfrom
text-attributes
Feb 16, 2026
Merged

Text attributes#148
abnegate merged 5 commits intomainfrom
text-attributes

Conversation

@fogelito
Copy link
Contributor

@fogelito fogelito commented Feb 15, 2026

Summary by CodeRabbit

  • New Features

    • Added migration support for VARCHAR plus standard, medium, and long text columns, preserving size and format during export/import.
  • Refactor

    • Introduced dedicated column types and extended export mappings to streamline text-type handling.
  • Tests / Style

    • Minor test formatting tweaks with no behavioral changes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

Walkthrough

Adds four new text column types and wiring across migration layers. Column.php adds constants TYPE_TEXT, TYPE_VARCHAR, TYPE_MEDIUMTEXT, and TYPE_LONGTEXT. New column classes Varchar, RegularText, MediumText, and LongText (constructors, fromArray factories, and getters) are added under Migration/Resources/Database/Columns. Migration source Appwrite now instantiates Varchar/TEXT/MEDIUMTEXT/LONGTEXT columns; migration destination Appwrite maps those types to corresponding UtopiaDatabase VAR_VARCHAR, VAR_TEXT, VAR_MEDIUMTEXT, and VAR_LONGTEXT. Small whitespace-only test changes are included.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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 'Text attributes' accurately reflects the main change: adding support for text column types (VARCHAR, TEXT, MEDIUMTEXT, LONGTEXT) and their corresponding column classes with attributes like size and format.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ 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 text-attributes

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
src/Migration/Resources/Database/Columns/Varchar.php (1)

5-5: Remove unused Database import on line 5.

The Utopia\Database\Database import is never referenced in this class. This pattern is consistent across all text column classes (RegularText, MediumText, LongText).

Proposed fix
-use Utopia\Database\Database;
 use Utopia\Migration\Resources\Database\Column;

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

🤖 Fix all issues with AI agents
In `@src/Migration/Destinations/Appwrite.php`:
- Around line 473-475: The mapping arms for Column::TYPE_TEXT, TYPE_MEDIUMTEXT
and TYPE_LONGTEXT are correct, but fix the source column classes and the
Appwrite case so those arms are reachable: update Text.php so its getType()
returns Column::TYPE_TEXT (not TYPE_STRING), update MediumText::getType() to
return Column::TYPE_MEDIUMTEXT, update LongText::getType() to return
Column::TYPE_LONGTEXT, and in src/Migration/Destinations/Appwrite.php ensure the
TYPE_LONGTEXT case instantiates LongText (not MediumText); leave the
VAR_TEXT/VAR_MEDIUMTEXT/VAR_LONGTEXT destination constants as-is.

In `@src/Migration/Resources/Database/Columns/LongText.php`:
- Around line 9-97: The Column::TYPE_LONGTEXT branch in the Appwrite source
currently instantiates MediumText, leaving LongText unused; update the
switch/case (the Column::TYPE_LONGTEXT handling in
src/Migration/Sources/Appwrite.php) to instantiate LongText instead of
MediumText, passing the same constructor arguments used for MediumText so
signatures match, and add or adjust any use/import for the LongText class if
missing; this will ensure LongText is actually created when getType() returns
Column::TYPE_LONGTEXT.

In `@src/Migration/Resources/Database/Columns/MediumText.php`:
- Around line 83-86: The getType() implementation in the MediumText class
currently returns Column::TYPE_STRING causing MediumText columns to be treated
as plain strings; update MediumText::getType() to return Column::TYPE_MEDIUMTEXT
so the Column::TYPE_MEDIUMTEXT → VAR_MEDIUMTEXT mapping in
Destinations/Appwrite.php is hit and the correct destination type is used.

In `@src/Migration/Sources/Appwrite.php`:
- Around line 1122-1133: The CASE for Column::TYPE_LONGTEXT incorrectly
instantiates MediumText (losing the LONGTEXT identity); replace the MediumText
instantiation with LongText and add the missing import for
Utopia\Migration\Resources\Database\Columns\LongText at the top of the file so
the TYPE_LONGTEXT branch constructs a LongText object (preserving required,
default, array, size, createdAt, updatedAt parameters) instead of MediumText.

@abnegate abnegate merged commit aa07cf9 into main Feb 16, 2026
4 checks passed
@abnegate abnegate deleted the text-attributes branch February 16, 2026 07:19
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