Getting errors deleting documents from collection related with another Simplified Setup: 3 related collections
- Color (attrb: name)
- Shape (attrib: name, shapeColor[related field])
- ShapeColor (attrib: color[FK: <one way> m-to-1 on Color on delete set null], shape[FK: <two way> m-to-1 on Shap on delete cascade]
Deleting a document from Color doesn't set the related fields in ShapeColor to null but throws an Server error
. Appwrite container logs
2023-12-08T15:18:22.985230878Z [Error] Timestamp: 2023-12-08T15:18:22+00:00
2023-12-08T15:18:22.985262759Z [Error] Method: DELETE
2023-12-08T15:18:22.985266599Z [Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
2023-12-08T15:18:22.985270119Z [Error] Type: Utopia\Database\Exception
2023-12-08T15:18:22.985272879Z [Error] Message: Unknown PDO Type for object
2023-12-08T15:18:22.985275519Z [Error] File: /usr/src/code/vendor/utopia-php/database/src/Database/Adapter/MariaDB.php
2023-12-08T15:18:22.985278319Z [Error] Line: 1878
Conversly, deleting a document from ShapeColor throws Document not found
exception
Appwrite container logs
2023-12-08T16:05:44.447421368Z [Error] Method: DELETE
2023-12-08T16:05:44.447424608Z [Error] URL: /v1/databases/:databaseId/collections/:collectionId/documents/:documentId
2023-12-08T16:05:44.447427528Z [Error] Type: Appwrite\Extend\Exception
2023-12-08T16:05:44.447430128Z [Error] Message: Document with the requested ID could not be found.
2023-12-08T16:05:44.447432808Z [Error] File: /usr/src/code/app/controllers/api/databases.php
2023-12-08T16:05:44.447435408Z [Error] Line: 3557
Update: There are multiple issues with deleting documents with relationships in general. Here are some relevant issues: https://github.com/appwrite/appwrite/issues/7170 https://github.com/appwrite/appwrite/issues/5850
I know relationships are experimental but I allowed myself to be temptep by the dark side (normalisation). I'll be creating relationships manually.
[Closed] Error deleting documents with relationship
Recommended threads
- Having issues with login via CLI
``` ~/appwrite appwrite login --endpoint https://localhost/v1 --verbose ? Enter your email myvalidemai...
- Attributes Confusion
```import 'package:appwrite/models.dart'; class OrdersModel { String id, email, name, phone, status, user_id, address; int discount, total, created_at; L...
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...