new finctions and fixes

This commit is contained in:
Mateusz Gruszczyński
2026-07-30 00:12:48 +02:00
parent 9ca055de5f
commit 2274cf57c9
31 changed files with 1348 additions and 505 deletions
@@ -0,0 +1,26 @@
CREATE TABLE user_editor_preferences (
user_id INTEGER NOT NULL,
pad_id INTEGER,
note_id INTEGER,
authorship_mode TEXT NOT NULL DEFAULT 'simple',
colors_enabled INTEGER NOT NULL DEFAULT 1,
compact_view INTEGER NOT NULL DEFAULT 1,
editor_line_numbers INTEGER NOT NULL DEFAULT 1,
preview_line_numbers INTEGER NOT NULL DEFAULT 0,
line_links INTEGER NOT NULL DEFAULT 0,
font_family TEXT NOT NULL DEFAULT 'mono',
font_size INTEGER NOT NULL DEFAULT 14,
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (pad_id) REFERENCES pads(id) ON DELETE CASCADE,
FOREIGN KEY (note_id) REFERENCES notes(id) ON DELETE CASCADE,
CHECK ((pad_id IS NOT NULL AND note_id IS NULL) OR (pad_id IS NULL AND note_id IS NOT NULL)),
UNIQUE (user_id, pad_id),
UNIQUE (user_id, note_id)
);
CREATE INDEX idx_user_editor_preferences_user ON user_editor_preferences(user_id);
CREATE INDEX idx_user_editor_preferences_pad ON user_editor_preferences(pad_id);
CREATE INDEX idx_user_editor_preferences_note ON user_editor_preferences(note_id);
DROP TABLE resource_editor_settings;