-
Notifications
You must be signed in to change notification settings - Fork 298
Update createTable code examples to include columns and indexes #2674
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis pull request updates documentation examples for the createTable API across multiple Server SDKs (Node.js, Deno, PHP, Python, Ruby, Java, Kotlin, Dart, C#, Swift, and others). Each example replaces previous positional/minimal calls with a single object payload that includes databaseId, tableId, name, and expanded columns and indexes arrays defining many column types, relationships, and index definitions. A small punctuation change also adjusts a permissions note ("Learn more" capitalization and sentence punctuation). Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Pre-merge checks✅ Passed checks (3 passed)
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. Comment |
There was a problem hiding this 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
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/routes/docs/products/databases/tables/+page.markdoc
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-05T19:35:04.162Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/nuxt/step-6/+page.markdoc:79-83
Timestamp: 2025-09-05T19:35:04.162Z
Learning: In Nuxt tutorial files, the correct Appwrite database instance to use is `tablesDB` (imported from "~/appwrite"), not `database`. All tablesDB method calls should use the object parameter format: listRows({ databaseId, tableId, queries }), createRow({ databaseId, tableId, rowId, data }), and deleteRow({ databaseId, tableId, rowId }).
Applied to files:
src/routes/docs/products/databases/tables/+page.markdoc
📚 Learning: 2025-09-05T19:35:53.943Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react/step-6/+page.markdoc:70-75
Timestamp: 2025-09-05T19:35:53.943Z
Learning: In React tutorial files, the correct Appwrite database instance to import is `tablesDB` from "../appwrite", not `databases`. The import statement should be `import { tablesDB } from "../appwrite"` to match the usage throughout the React tutorial code.
Applied to files:
src/routes/docs/products/databases/tables/+page.markdoc
📚 Learning: 2025-09-05T19:35:59.449Z
Learnt from: ebenezerdon
Repo: appwrite/website PR: 2372
File: src/routes/docs/tutorials/react-native/step-6/+page.markdoc:67-73
Timestamp: 2025-09-05T19:35:59.449Z
Learning: In React Native tutorials, the lib/appwrite.js file exports `tablesDB` (not `databases`), so imports should use `import { tablesDB } from "../lib/appwrite"` to match the export pattern established in step-3.
Applied to files:
src/routes/docs/products/databases/tables/+page.markdoc
⏰ 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). (2)
- GitHub Check: build
- GitHub Check: assets
🔇 Additional comments (2)
src/routes/docs/products/databases/tables/+page.markdoc (2)
1178-1178: LGTM - Clear and well-formatted documentation text.The updated permissions note properly directs users to learn more about the
createTablemethod in the API references.
39-1174: Documentation examples are syntactically correct and well-structured across all Server SDKs.The expanded examples effectively demonstrate comprehensive table creation with 13 column types and 3 index types in consistent, language-appropriate syntax. No formatting issues were found in the Dart block or elsewhere.
However, verification of actual API signature compatibility with the Appwrite SDKs requires access to the SDK repositories themselves (appwrite/sdk-for-nodejs, appwrite/sdk-for-php, etc.), which are not available in this documentation website repository. The examples appear internally consistent and correct, but definitive validation that the
createTablemethod accepts the demonstratedcolumnsandindexesparameters with all shown column types (email, enum, relationship, etc.), relationship properties (relatedTableId, relationType, twoWay, twoWayKey, onDelete), and index types (unique, key, fulltext) cannot be performed without access to those SDK repositories.
| }, | ||
| { | ||
| 'key': 'path', | ||
| 'type': 'line', | ||
| 'required': false | ||
| }, | ||
| { | ||
| 'key': 'area', | ||
| 'type': 'polygon', | ||
| 'required': false | ||
| }, | ||
| { | ||
| 'key': 'related_items', | ||
| 'type': 'relationship', | ||
| 'relatedTableId': '<RELATED_TABLE_ID>', | ||
| 'relationType': 'manyToMany', | ||
| 'twoWay': true, | ||
| 'twoWayKey': 'items', | ||
| 'onDelete': 'cascade', | ||
| 'required': false | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Fix indentation inconsistency in Dart example.
Lines 790-810 have excessive indentation compared to the preceding lines in the same columns array (lines 738-789). This formatting inconsistency reduces readability.
🔎 Proposed fix for consistent indentation
{
'key': 'location',
'type': 'point',
'required': false
- },
- {
- 'key': 'path',
- 'type': 'line',
- 'required': false
- },
- {
- 'key': 'area',
- 'type': 'polygon',
- 'required': false
- },
- {
- 'key': 'related_items',
- 'type': 'relationship',
- 'relatedTableId': '<RELATED_TABLE_ID>',
- 'relationType': 'manyToMany',
- 'twoWay': true,
- 'twoWayKey': 'items',
- 'onDelete': 'cascade',
- 'required': false
+ },
+ {
+ 'key': 'path',
+ 'type': 'line',
+ 'required': false
+ },
+ {
+ 'key': 'area',
+ 'type': 'polygon',
+ 'required': false
+ },
+ {
+ 'key': 'related_items',
+ 'type': 'relationship',
+ 'relatedTableId': '<RELATED_TABLE_ID>',
+ 'relationType': 'manyToMany',
+ 'twoWay': true,
+ 'twoWayKey': 'items',
+ 'onDelete': 'cascade',
+ 'required': false
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| }, | |
| { | |
| 'key': 'path', | |
| 'type': 'line', | |
| 'required': false | |
| }, | |
| { | |
| 'key': 'area', | |
| 'type': 'polygon', | |
| 'required': false | |
| }, | |
| { | |
| 'key': 'related_items', | |
| 'type': 'relationship', | |
| 'relatedTableId': '<RELATED_TABLE_ID>', | |
| 'relationType': 'manyToMany', | |
| 'twoWay': true, | |
| 'twoWayKey': 'items', | |
| 'onDelete': 'cascade', | |
| 'required': false | |
| } | |
| }, | |
| { | |
| 'key': 'path', | |
| 'type': 'line', | |
| 'required': false | |
| }, | |
| { | |
| 'key': 'area', | |
| 'type': 'polygon', | |
| 'required': false | |
| }, | |
| { | |
| 'key': 'related_items', | |
| 'type': 'relationship', | |
| 'relatedTableId': '<RELATED_TABLE_ID>', | |
| 'relationType': 'manyToMany', | |
| 'twoWay': true, | |
| 'twoWayKey': 'items', | |
| 'onDelete': 'cascade', | |
| 'required': false | |
| } |
🤖 Prompt for AI Agents
In src/routes/docs/products/databases/tables/+page.markdoc around lines 790 to
810, the Dart example's entries in the columns array are over-indented compared
to earlier entries (lines 738-789); adjust the indentation of the objects from
lines 790–810 so they align with the preceding array items (same nesting/indent
level), ensuring consistent spacing for keys like 'key', 'type', 'required', and
the nested properties ('relatedTableId', 'relationType', etc.) to match the
style used earlier in the array.
What does this PR do?
Updates
createTablecode examples to demonstrate full schema creationTest Plan
Visit
/docs/products/tablesdb/tablesRelated PRs and Issues
N/A
Have you read the Contributing Guidelines on issues?
Yes
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.