mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
- C-1: handle filepath.Abs error in backup path traversal guards - C-2: WAL checkpoint before live DB restore to prevent corruption - C-4: default AllowedOrigins to empty (deny cross-origin by default) - C-5: renumber duplicate 003_ migration prefix (003-008 -> 003-009) - H-1: sanitize FTS5 query input to prevent operator injection - H-3: send SIGTERM for graceful shutdown before os.Exit in updater - H-9: fix RingBuffer memory leak from unbounded backing array growth - H-10: use errorResponse struct consistently in upload handler
20 lines
858 B
SQL
20 lines
858 B
SQL
-- Migration 008: Direct Message tables.
|
|
-- Adds dm_participants and dm_open_state tables for DM channel support.
|
|
-- The channels.type column is TEXT with no CHECK constraint, so 'dm' is
|
|
-- already a valid value — no schema alteration needed.
|
|
|
|
CREATE TABLE IF NOT EXISTS dm_participants (
|
|
channel_id INTEGER NOT NULL REFERENCES channels(id) ON DELETE CASCADE,
|
|
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
PRIMARY KEY (channel_id, user_id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_dm_participants_user ON dm_participants(user_id);
|
|
|
|
CREATE TABLE IF NOT EXISTS dm_open_state (
|
|
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
|
channel_id INTEGER NOT NULL REFERENCES channels(id) ON DELETE CASCADE,
|
|
opened_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
PRIMARY KEY (user_id, channel_id)
|
|
);
|