Successfully migrated WhisperRNote's Appwrite database layer from the legacy Databases API to the new TablesDB API terminology while maintaining full backward compatibility.
- Added
TablesDBimport fromappwriteSDK - Instantiated
tablesDBservice instance alongside existing services - Exported
tablesDBfor use across the application
| Old (Databases) | New (TablesDB) |
|---|---|
databases.createDocument() |
tablesDB.createRow() |
databases.getDocument() |
tablesDB.getRow() |
databases.updateDocument() |
tablesDB.updateRow() |
databases.deleteDocument() |
tablesDB.deleteRow() |
databases.listDocuments() |
tablesDB.listRows() |
// Old: databases.createDocument
databases.createDocument(
databaseId,
collectionId,
documentId,
data,
permissions
)
// New: tablesDB.createRow
tablesDB.createRow({
databaseId,
tableId: collectionId,
rowId: documentId,
data,
permissions
})// Old: response.documents
const result = await databases.listDocuments(...)
result.documents // Array of documents
// New: response.rows
const result = await tablesDB.listRows(...)
result.rows // Array of rows-
Notes (
src/lib/appwrite/notes/index.ts)- All CRUD operations migrated
- Tag pivot table operations updated
- Revision logging updated
-
Tags (
src/lib/appwrite/tags/index.ts)- Tag CRUD operations migrated
- Usage count adjustments updated
-
API Keys (
src/lib/appwrite/apikeys/index.ts)- API key management migrated
-
Collaborators (
src/lib/appwrite/collaborators/index.ts)- Note sharing operations migrated
- Permission management updated
-
User Profile (
src/lib/appwrite/user-profile.ts)- User CRUD operations migrated
- User search functionality updated
-
Usage Metrics (
src/lib/appwrite/usage/metrics.ts)- Count operations migrated for notes, API keys, collaborators
-
Permissions
src/lib/appwrite/permissions/notes.ts- Note permission handlingsrc/lib/appwrite/permissions/extensions.ts- Extension permission handling
- Added
TablesDBimport and instantiation - Exported
tablesDBin named exports - Added
tablesDBto default export object - Maintained all existing function signatures for backward compatibility
The database configuration is stored in appwrite.config.json:
- Database ID:
67ff05a9000296822396(whisperrnote) - Tables include: users, notes, tags, apikeys, collaborators, etc.
- All tables have
rowSecurity: trueenabled - Permissions managed through Role-based access control
✅ Build successful (npm run build)
✅ No breaking changes to component interfaces
✅ All modular layers migrated consistently
✅ Response structure compatibility maintained through adapter patterns
- Future-proof: Uses Appwrite's new TablesDB terminology
- Non-breaking: Maintains existing API surface
- Consistent: Unified approach across all data modules
- Maintainable: Clear separation between legacy and new code
- Push changes to repository when authentication is configured
- Monitor production deployment for any edge cases
- Consider deprecating legacy
src/lib/notes.tsand similar files in favor of modularsrc/lib/appwrite/*structure - Update any server-side API routes that may still use old Databases terminology
src/lib/appwrite/core/client.ts- Added TablesDBsrc/lib/appwrite/notes/index.ts- Migrated all note operationssrc/lib/appwrite/tags/index.ts- Migrated tag operationssrc/lib/appwrite/apikeys/index.ts- Migrated API key operationssrc/lib/appwrite/collaborators/index.ts- Migrated collaborationsrc/lib/appwrite/user-profile.ts- Migrated user operationssrc/lib/appwrite/usage/metrics.ts- Migrated counting operationssrc/lib/appwrite/permissions/notes.ts- Updated note permissionssrc/lib/appwrite/permissions/extensions.ts- Updated extension permissionssrc/lib/appwrite.ts- Added TablesDB exportsappwrite.config.json- Database configuration (new file)
Commit: 4daa09f
Message: Migrate Appwrite database layer to TablesDB API
Files Changed: 21
Insertions: +7757
Deletions: -606
- The
databasesservice instance is still available for any legacy code - Both
databasesandtablesDBcan coexist during transition period - All new code should use
tablesDBfor consistency with Appwrite's direction - The migration maintains data structure compatibility - no database schema changes required