Skip to content

Feat string types#2838

Merged
ItzNotABug merged 14 commits intomainfrom
feat-string-types
Feb 6, 2026
Merged

Feat string types#2838
ItzNotABug merged 14 commits intomainfrom
feat-string-types

Conversation

@abnegate
Copy link
Member

@abnegate abnegate commented Feb 6, 2026

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • New Features

    • Added dedicated editors and create/update flows for new text column types: Text, Varchar, Mediumtext, Longtext. Varchar includes row-size visualization and overflow warnings.
  • Changes

    • Default column type now defaults to "Text" instead of "String".
    • Broader text-type support across UI: indexing, column sizing, display name selection, row rendering, and improved index order display ("None" rendering).
    • Migration UI: simplified resource grouping and removed an outdated functions warning.
    • Function/API scopes and backup/service selectors now use typed constants for consistency.
  • Chores

    • Updated internal dependency reference for console package.

@appwrite
Copy link

appwrite bot commented Feb 6, 2026

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

Dynamic API keys are generated automatically for each function execution

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Warning

Rate limit exceeded

@abnegate has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Walkthrough

Adds four new text column types (varchar, text, mediumtext, longtext) across types, helpers, stores, row renderers, and UI editors with create/update SDK handlers; preserves a deprecated String option. Extends faker and filter operator type support for these types. Replaces IndexOrder with OrderBy in index flows. Replaces literal service and resource strings with BackupServices and Resources enums in backups and migration logic. Tightens numerous function/API scope typings to Scopes. Updates the @appwrite.io/console dependency reference in package.json.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Feat string types' is vague and does not clearly summarize the main changes. The PR introduces multiple new string-based column types (Text, Varchar, Mediumtext, Longtext), refactors type handling across the codebase, updates dependency versions, and migrates to using Scopes enums. The title is too generic and lacks specificity about the actual implementation. Consider a more descriptive title such as 'Add support for varchar, text, mediumtext, and longtext column types' or 'Introduce extended string column types and improve type safety' to clearly communicate the primary scope of changes.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat-string-types

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte (2)

999-1082: ⚠️ Potential issue | 🔴 Critical

Add handlers for new text column types (text, varchar, mediumtext, longtext) in createColumns.

The new text types are available for selection in the column picker via basicColumnOptions, but this switch statement has no cases for them. If a user selects one of these types and clicks "Apply", the switch falls through silently — columnResult remains undefined, gets pushed to results, and the column is never created on the backend.

Add cases for each type:

Proposed fix
                    case 'polygon':
                        columnResult = await client.tablesDB.createPolygonColumn(baseParams);
                        break;
+
+                    case 'text':
+                        columnResult = await client.tablesDB.createTextColumn({
+                            ...baseParams,
+                            xdefault: (column.default as string) || null
+                        });
+                        break;
+
+                    case 'varchar':
+                        columnResult = await client.tablesDB.createVarcharColumn({
+                            ...baseParams,
+                            size: column.size || 255,
+                            xdefault: (column.default as string) || null
+                        });
+                        break;
+
+                    case 'mediumtext':
+                        columnResult = await client.tablesDB.createMediumtextColumn({
+                            ...baseParams,
+                            xdefault: (column.default as string) || null
+                        });
+                        break;
+
+                    case 'longtext':
+                        columnResult = await client.tablesDB.createLongtextColumn({
+                            ...baseParams,
+                            xdefault: (column.default as string) || null
+                        });
+                        break;
                 }

1114-1128: ⚠️ Potential issue | 🟠 Major

Update placeholder columns to use type: 'text' instead of type: 'string'.

The placeholder columns use type: 'string', but this type does not exist in columnOptions—available database types are 'text', 'mediumtext', 'longtext', 'varchar', 'integer', 'double', 'boolean', 'datetime', and 'point'. When getColumnOption('string') is called, it returns undefined, causing the UI to fall back to 'Text'. Change the placeholder type to 'text' to match the first available option and ensure consistency with the type system. Additionally, verify that mockSuggestions.columns in the store also uses valid database types.

🤖 Fix all issues with AI agents
In
`@src/routes/`(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte:
- Around line 35-37: The prop type for column needs to include all string-like
column models; update the column prop union to add Models.ColumnVarchar,
Models.ColumnText, Models.ColumnMediumtext, and Models.ColumnLongtext so the
component accepts the types mapped by column.svelte, and change the cast at the
size expression (currently "(column as Models.ColumnString).size") to a broader
union that includes Models.ColumnVarchar (e.g., cast to Models.ColumnString |
Models.ColumnVarchar or a union of all string-like models exposing .size) so the
.size access is type-safe.
🧹 Nitpick comments (2)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/settings/displayName.svelte (1)

48-53: Consider extracting the textTypes array to a shared constant.

The same ['string', 'varchar', 'text', 'mediumtext', 'longtext'] array is defined in multiple places (here, rows/store.ts, and likely others). Extracting it to a shared utility (e.g., alongside isTextType in rows/store.ts or in a common helpers file) would keep the list in sync as types evolve.

src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/varchar.svelte (1)

93-96: Consider disabling submit when row size is exceeded.

exceedsLimit is used only for a visual warning (Lines 147-151), but nothing prevents the user from actually submitting a column that exceeds the row size limit. The server will reject it, but the UX would be smoother if the form submit were also disabled when exceedsLimit is true.

…ckupServices

- Replace IndexOrder enum with SDK's OrderBy enum in indexes-related files
- Cast scopes arrays to Scopes[] type in function settings files
- Use Resources enum values in migration store and forms
- Use BackupServices enum in database backup operations
- Update migrations pages to use Scopes enum instead of string literals

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/routes/(console)/project-[region]-[project]/functions/create-function/template-[template]/+page.svelte (1)

1-1: ⚠️ Potential issue | 🟡 Minor

Fix Prettier formatting issues flagged by CI.

The pipeline reports code style issues found by Prettier for this file. Please run prettier --write on this file to resolve.

src/lib/stores/migration.ts (1)

140-158: ⚠️ Potential issue | 🔴 Critical

Shallow copy mutates initialFormData — this corrupts subsequent calls.

{ ...initialFormData } is a shallow copy. The nested objects (users, databases, functions, storage) are still shared references. When you set formData.users.root = true on Line 143, you mutate the original initialFormData.users object. After the first selectAll() call, initialFormData is permanently tainted, breaking deselectAll() and store resets.

The same shallow-copy pattern exists in createMigrationFormStore (Line 27–29).

🐛 Proposed fix — use a deep-clone helper
+const cloneFormData = (): MigrationFormData => JSON.parse(JSON.stringify(initialFormData));
+
 export const createMigrationFormStore = () => {
-    const store = writable({ ...initialFormData });
+    const store = writable(cloneFormData());
     const reset = () => {
-        store.set({ ...initialFormData });
+        store.set(cloneFormData());
     };
 
     return {
         ...store,
         reset
     };
 };
-export const resourcesToMigrationForm = (resources: Resources[]): MigrationFormData => {
-    const formData = { ...initialFormData };
+export const resourcesToMigrationForm = (resources: Resources[]): MigrationFormData => {
+    const formData = cloneFormData();
     if (resources.includes(Resources.User)) {
🤖 Fix all issues with AI agents
In `@src/routes/`(console)/(migration-wizard)/resource-form.svelte:
- Around line 100-102: The alert about functions is now unreachable because
shouldRenderGroup('functions') always returns false; update the UI by removing
the unreachable <Alert.Inline> or change its copy/placement to reflect reality:
either delete the functions-specific alert block (the conditional that renders
the Alert.Inline for "Functions not available for import") or move it outside
the functions group check and change the message to a generic "Functions import
is not currently supported" so it no longer implies provider/version-specific
behavior; search for shouldRenderGroup('functions') and the Alert.Inline that
references functions to locate the code to update.

In
`@src/routes/`(console)/project-[region]-[project]/functions/function-[function]/settings/updateScopes.svelte:
- Line 42: The scopes field currently sends "functionScopes as ScopesType[]"
which can be null; change the payload to pass "functionScopes as ScopesType[] ||
undefined" (or equivalent) so null is converted to undefined before the API
call. Locate the code in updateScopes.svelte where scopes is assigned
(reference: functionScopes and ScopesType) and add the || undefined fallback to
match the pattern used in updateRuntime.svelte/updateName.svelte and ensure the
API never receives a null scopes value.
🧹 Nitpick comments (6)
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateBuildCommand.svelte (1)

16-16: Pre-existing: function name updateLogging doesn't match its purpose.

This function updates the build command (per the notification message and analytics event), but is named updateLogging — likely a copy-paste artifact. Consider renaming to updateBuildCommand for clarity.

✏️ Suggested rename
-    async function updateLogging() {
+    async function updateBuildCommand() {

And on line 58:

-<Form onSubmit={updateLogging}>
+<Form onSubmit={updateBuildCommand}>
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateLogging.svelte (1)

34-34: Cast is acceptable but lacks runtime validation unlike Runtime.

The as Scopes[] cast safely bridges the string[] model type to the expected Scopes[] parameter type. Since scopes originate from the server, they should always be valid enum members, making this reasonable.

Worth noting: Runtime is validated at runtime via isValueOfStringEnum (line 19), but scopes is not. If you ever want parity, a similar guard could be added. This is a minor inconsistency and not blocking, especially since this pattern is applied consistently across all function settings files.

src/routes/(console)/project-[region]-[project]/functions/create-function/template-[template]/+page.svelte (1)

143-143: Cast looks correct; consider declaring selectedScopes as Scopes[] at the source.

The as Scopes[] cast is safe here given the values originate from the Permissions component. However, declaring selectedScopes as Scopes[] (line 65) instead of string[] would push type safety upstream and eliminate the need for this assertion entirely.

-    let selectedScopes: string[] = [];
+    let selectedScopes: Scopes[] = [];
src/lib/stores/migration.ts (2)

55-56: Object.values(Resources) auto-includes any future enum members.

This is likely intentional for Appwrite-to-Appwrite migrations (all resources should be migratable), but worth noting: if the upstream Resources enum gains values that the migration backend doesn't support yet, this will silently pass unsupported resource types. A brief inline comment confirming the intent would help future maintainers.


148-153: Unnecessary as Resources[] casts.

The array literals already contain Resources enum values, so TypeScript infers the type correctly. The as Resources[] casts are redundant.

Proposed cleanup
     if (
-        includesAll(resources, [Resources.Table, Resources.Column, Resources.Row] as Resources[])
+        includesAll(resources, [Resources.Table, Resources.Column, Resources.Row])
     ) {
         formData.databases.rows = true;
     }
-    if (includesAll(resources, [Resources.Bucket, Resources.File] as Resources[])) {
+    if (includesAll(resources, [Resources.Bucket, Resources.File])) {
         formData.storage.root = true;
     }
src/routes/(console)/project-[region]-[project]/settings/migrations/exportModal.svelte (1)

94-112: Scopes list is duplicated with +page.svelte's deployToCloud.

Lines 94–112 define the exact same scopes array as deployToCloud in +page.svelte (Lines 92–110). Consider extracting a shared migrationScopes constant (e.g., in $lib/stores/migration.ts alongside the other migration utilities) to keep both call sites in sync.

abnegate and others added 4 commits February 6, 2026 18:32
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ColumnVarchar, ColumnText, ColumnMediumtext, ColumnLongtext to string.svelte column prop type
- Update type cast to include ColumnVarchar for size property access
- Remove unreachable functions migration alert (shouldRenderGroup always returns false for functions)
- Add || undefined fallback to scopes in updateScopes.svelte for consistency

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
abnegate and others added 3 commits February 6, 2026 20:47
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move casts to the model boundary (where SDK models return string[])
and remove unnecessary casts at SDK call sites.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
import { Fieldset, Layout, Selector } from '@appwrite.io/pink-svelte';
import type { Scopes } from '@appwrite.io/console';

export let templateScopes: string[];
Copy link
Member

Choose a reason for hiding this comment

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

can be Scopes[]? 👀

entrypoint: $func.entrypoint,
commands: $func.commands || undefined,
scopes: $func.scopes || undefined,
scopes: ($func.scopes as Scopes[]) || undefined,
Copy link
Member

Choose a reason for hiding this comment

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

might need the sdk model to return func.scopes as Scopes and not string[] later. Not a blocker for this one for now 👍

@ItzNotABug ItzNotABug merged commit e7ac9e2 into main Feb 6, 2026
4 checks passed
@ItzNotABug ItzNotABug deleted the feat-string-types branch February 6, 2026 14:51
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