Skip to content
Back

Relationship Attribute Deletion Causes Data Loss on Minor Schema Changes

  • 0
  • Cloud
lukebrandonfarrell
26 Jun, 2025, 17:17

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:

TypeScript
{
  "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

TL;DR
Critical bug in Appwrite CLI causes complete data loss when making minor schema changes to relationship attributes. Changing onDelete property in appwrite.json led to CLI deleting entire relationship attribute, destroying existing data, and leaving database in a broken state. Expected behavior is for schema update to only affect future deletion behavior, not existing data. Developers are requesting a fix to handle relationship schema changes without data loss to maintain data integrity in production environments. Solution: - Developers should proceed with caution when making schema changes to relationship attributes in order to prevent data loss.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more