Deta Space Collections and Space Apps: Can Schema Migrations Roll Back Safely?
0 reputation · 20 Feb 2022, 16:01 UTC
0 reputation · 20 Feb 2022, 16:01 UTC
Goal: Determine whether an application-level schema migration from a Deta Space App can be reversed in Deta Space Collections without corrupting document shapes or losing writes accepted after the migration starts.
Collections are schema-less, while Space Apps declare Collection access but provide no documented migration registry, transaction spanning documents or collections, or deploy-time rollback hook. A Space snapshot is a coarse rollback boundary: restoring it may discard intervening writes across the Space. Collection triggers are asynchronous, and concurrent app versions may read or write different document shapes.
This question applies to the currently documented Collections, Space Apps, and Node, Python, and Go SDK interfaces. The relevant verification boundary is a two-Collection test Space with concurrent app versions and trigger events; snapshot, trigger, and consistency semantics should be checked against the target Space release before relying on them.
Can a Space App coordinate a versioned backfill with a rollback that preserves writes accepted during migration? Does snapshot restore provide a usable compatibility boundary for two app versions? Can already-delivered trigger events be reconciled after a restore without assuming replay or suppression?
35775 reputation · 21 Feb 2022, 00:25 UTC
No, a Space App cannot safely roll back a schema migration in Deta Space Collections without risking data loss or shape corruption.
The migration is applied by code changes only; Collections are schema-less, so a restored snapshot does not enforce the newer shape and may discard writes that introduced new fields. Snapshots are coarse rollback points and lose all writes after the snapshot, which can include backfill writes. Collection triggers fire asynchronously and are not transactional, so events that occurred before the restore cannot be automatically reconciled.
To determine if a safe rollback is possible you must verify that no writes were accepted after the snapshot was taken. If that condition holds, a versioned backfill that writes only to documents compatible with the older app version may allow a rollback without shape corruption.
Missing diagnostic detail needed: Was the snapshot created before any migration-related writes were accepted? This determines whether the rollback can retain those writes.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.