Changeset 0.17.3 (#78)
This commit is contained in:
26
server/database/migrations/sqlite/002_v0173_note_links.sql
Normal file
26
server/database/migrations/sqlite/002_v0173_note_links.sql
Normal file
@@ -0,0 +1,26 @@
|
||||
-- v0.17.3: Note Links + Wikilink Infrastructure (SQLite)
|
||||
--
|
||||
-- New: note_links table for [[wikilink]] graph edges
|
||||
-- New: notes.source_message_id for chat-to-note provenance
|
||||
|
||||
-- =========================================
|
||||
-- 1. Note Links
|
||||
-- =========================================
|
||||
|
||||
CREATE TABLE IF NOT EXISTS note_links (
|
||||
source_note_id TEXT NOT NULL REFERENCES notes(id) ON DELETE CASCADE,
|
||||
target_note_id TEXT REFERENCES notes(id) ON DELETE CASCADE,
|
||||
target_title TEXT NOT NULL,
|
||||
display_text TEXT,
|
||||
is_transclusion INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TEXT DEFAULT (datetime('now')),
|
||||
PRIMARY KEY (source_note_id, target_title)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_note_links_target ON note_links(target_note_id);
|
||||
|
||||
-- =========================================
|
||||
-- 2. Source Message Provenance
|
||||
-- =========================================
|
||||
|
||||
ALTER TABLE notes ADD COLUMN source_message_id TEXT;
|
||||
Reference in New Issue
Block a user