summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-07-08 16:22:17 +0200
committererdgeist <erdgeist@erdgeist.org>2026-07-08 16:22:17 +0200
commita006440f59bf99380e179cc2963cb98d4d894d3a (patch)
treeae74b9bdf00e7218b90a6cb2c119504419fa8ae4 /db
parent08b4cdb711ffe39153264a5c4024fac95cd8d91a (diff)
Add head/draft/autosave hierarchy to Node
Introduces autosave_id as a third, unversioned layer above draft/head, with lock_for_editing!, autosave!, and save_draft! as the new entry points. Also fixes a real bug in wipe_draft!: its "no draft" branch unconditionally released the lock, which was safe when "no draft" only ever meant "nothing is happening" — no longer true now that a lock can exist with only an autosave beneath it. lock_for_editing! deliberately does not call wipe_draft! at all, for the same reason: an intruder calling it while a lock was genuinely held would otherwise silently steal it via wipe_draft!'s own unlock side effect, caught by the new two-user lock test.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20260708095943_add_autosave_id_to_nodes.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/db/migrate/20260708095943_add_autosave_id_to_nodes.rb b/db/migrate/20260708095943_add_autosave_id_to_nodes.rb
new file mode 100644
index 0000000..eedcc00
--- /dev/null
+++ b/db/migrate/20260708095943_add_autosave_id_to_nodes.rb
@@ -0,0 +1,5 @@
1class AddAutosaveIdToNodes < ActiveRecord::Migration[8.1]
2 def change
3 add_column :nodes, :autosave_id, :integer
4 end
5end