Web Developer
I'm experiencing a critical bug with Appwrite CLI that causes complete data loss when making minor schema changes to relationship attributes.
What I Tried To Do:
Changed a relationship attribute's onDelete property from "setNull" to "restrict" in my appwrite.json:
{
"key": "templateListing",
"type": "relationship",
"onDelete": "restrict" // Changed from "setNull"
}
What Actually Happened:
When running appwrite push collections, the CLI:
- Deleted the entire relationship attribute
- Destroyed all existing relationship data between Templates and TemplateListings
- Failed to recreate the attribute due to caching issues
- Left my database in a broken state with all relationship data permanently lost
Expected Behavior:
Changing onDelete behavior should be an in-place schema update that:
- Updates the constraint without touching existing data
- Preserves all existing relationships
Only affects future deletion behavior.
Actual Impact:
- Complete data loss of all Template ↔ TemplateListing relationships
- Production database corruption from a simple config change
Hours of work to manually restore relationships.
Request:
Please fix the CLI to handle relationship schema changes without data loss. Database systems should never delete user data for configuration changes.
This behavior makes Appwrite unsuitable for production use where data integrity is critical.
Environment:
Appwrite CLI: 6.1.0
Database: Cloud hosted