This commit is contained in:
Mateusz Gruszczyński
2026-07-20 15:59:15 +02:00
parent 771494671b
commit dfa0828c38
42 changed files with 964 additions and 755 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS note_revisions (
CREATE INDEX IF NOT EXISTS idx_notes_workspace ON notes(workspace_id, updated_at DESC);
CREATE INDEX IF NOT EXISTS idx_note_revisions_note ON note_revisions(note_id, id DESC);
-- Zachowanie danych z wersji 0.4.x: stara notatka staje się workspace z jedną notatką.
-- Preserve data from version 0.4.x: the old note becomes a workspace with one note.
INSERT OR IGNORE INTO workspaces (id, slug, title, password_hash, created_at, updated_at)
SELECT id, slug, title, password_hash, created_at, updated_at FROM pads;
+4
View File
@@ -0,0 +1,4 @@
ALTER TABLE notes ADD COLUMN owner_map TEXT NOT NULL DEFAULT '[]';
ALTER TABLE note_revisions ADD COLUMN author TEXT;
ALTER TABLE note_revisions ADD COLUMN owner_map TEXT NOT NULL DEFAULT '[]';
ALTER TABLE revisions ADD COLUMN author TEXT;
+2
View File
@@ -0,0 +1,2 @@
ALTER TABLE pads ADD COLUMN owner_map TEXT NOT NULL DEFAULT '[]';
ALTER TABLE revisions ADD COLUMN owner_map TEXT NOT NULL DEFAULT '[]';
+8
View File
@@ -0,0 +1,8 @@
CREATE TABLE published_pages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
token TEXT NOT NULL UNIQUE,
pad_id INTEGER UNIQUE REFERENCES pads(id) ON DELETE CASCADE,
note_id INTEGER UNIQUE REFERENCES notes(id) ON DELETE CASCADE,
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
CHECK ((pad_id IS NOT NULL AND note_id IS NULL) OR (pad_id IS NULL AND note_id IS NOT NULL))
);
+5
View File
@@ -0,0 +1,5 @@
ALTER TABLE pads ADD COLUMN file_token TEXT;
ALTER TABLE notes ADD COLUMN file_token TEXT;
CREATE UNIQUE INDEX IF NOT EXISTS idx_pads_file_token ON pads(file_token) WHERE file_token IS NOT NULL;
CREATE UNIQUE INDEX IF NOT EXISTS idx_notes_file_token ON notes(file_token) WHERE file_token IS NOT NULL;