Files
probably-rendering-one-more…/apps/waterfall-wiki/db/005_note_editing.sql
codex-bot ad398db781
waterfall-wiki CI and deployment / verify-and-deploy (push) Has been cancelled
studio CI and deployment / verify-and-deploy (push) Successful in 9m15s
Restore PROMPT branding, rename waterfall-wiki, and add system tag workflows
2026-10-27 00:35:59 +08:00

16 lines
679 B
PL/PgSQL

BEGIN;
ALTER TABLE posts ADD COLUMN edited_at timestamptz;
-- Code-authored Wiki pages retain their public IDs; saved edits outlive deployments.
CREATE TABLE note_edits (
page_id text PRIMARY KEY CHECK(page_id ~ '^[0-9a-f]{24}$'),
title text NOT NULL CHECK(length(btrim(title))>0), description text NOT NULL DEFAULT '',
markdown text NOT NULL DEFAULT '', updated_at timestamptz NOT NULL DEFAULT now()
);
CREATE TABLE note_edit_tags (
page_id text NOT NULL REFERENCES note_edits(page_id) ON DELETE CASCADE,
tag_id uuid NOT NULL REFERENCES tags(id) ON DELETE RESTRICT,
PRIMARY KEY(page_id,tag_id)
);
INSERT INTO schema_migrations(version) VALUES('005_note_editing');
COMMIT;