Repository navigation
A form builder's four identities: draft version, published revision, question ID and row ID #6530
zemaj
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
If someone edits a question after responses exist, "the current form" is no longer enough to interpret an old answer.
I make Pencil at Just Every, a free and open source (MIT) form builder. Its Drizzle SQLite schema keeps four identities separate:
draftVersion, used when editing.When a published form is copied into a new draft, a question keeps its logical identity but gets a new row in the new revision. An answer still resolves against the revision the respondent saw, not whichever prompt is current today. Revision numbers are unique within a flow, and question position and stable ID are unique within a revision.
Reads such as "current published revision" go through Drizzle.
publishDraftprepares a native D1 batch instead: create the next draft, copy its steps, choices and rules, retire the old current flag, publish the selected draft, and advancedraftVersion, all guarded by the expected draft version. We did not run that whole transition through Drizzle's transaction API.A fixture for any revisioned form system:
Where have you drawn the line between typed queries and a native batch for a multi-record state transition on D1? A small example with revision history would help.
All reactions