- Migrering 0004: notes-tabell (nodes i kunnskapsgrafen) - REST API: GET/PATCH notat - PG-adapter med 500ms debounce og 10s polling - NotesBlock: tittel + fritekst med auto-lagring og status - Seed: notater for begge workspaces, kalenderside med 2-1 layout Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 lines
666 B
PL/PgSQL
21 lines
666 B
PL/PgSQL
-- Sidelinja: Notater/Scratchpad
|
|
-- Avhenger av: 0001_initial_schema.sql (nodes, workspaces)
|
|
|
|
BEGIN;
|
|
|
|
CREATE TABLE notes (
|
|
id UUID PRIMARY KEY REFERENCES nodes(id) ON DELETE CASCADE,
|
|
parent_id UUID NOT NULL REFERENCES nodes(id),
|
|
title TEXT NOT NULL DEFAULT '',
|
|
content TEXT NOT NULL DEFAULT '',
|
|
created_by TEXT REFERENCES users(authentik_id),
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE TRIGGER trg_notes_updated_at BEFORE UPDATE ON notes
|
|
FOR EACH ROW EXECUTE FUNCTION set_updated_at();
|
|
|
|
COMMIT;
|
|
|
|
ALTER TYPE node_type ADD VALUE IF NOT EXISTS 'note';
|