v0.7.1 bugs fix for last update

This commit is contained in:
2026-03-11 15:38:28 -04:00
parent 39fa6e9ff2
commit d822784826
11 changed files with 244 additions and 150 deletions

View File

@@ -207,21 +207,23 @@ function initDb() {
console.log('[DB] Migration: user_group_names table ready');
} catch (e) { console.error('[DB] user_group_names migration error:', e.message); }
// Migration: pinned direct messages (per-user, up to 5)
// Migration: pinned messages within DMs (per-user, up to 5 per DM group)
try {
db.exec(`
CREATE TABLE IF NOT EXISTS pinned_direct_messages (
user_id INTEGER NOT NULL,
group_id INTEGER NOT NULL,
pinned_at TEXT NOT NULL DEFAULT (datetime('now')),
pin_order INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (user_id, group_id),
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE
CREATE TABLE IF NOT EXISTS pinned_messages (
user_id INTEGER NOT NULL,
message_id INTEGER NOT NULL,
group_id INTEGER NOT NULL,
pinned_at TEXT NOT NULL DEFAULT (datetime('now')),
pin_order INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY (user_id, message_id),
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
FOREIGN KEY (message_id) REFERENCES messages(id) ON DELETE CASCADE,
FOREIGN KEY (group_id) REFERENCES groups(id) ON DELETE CASCADE
)
`);
console.log('[DB] Migration: pinned_direct_messages table ready');
} catch (e) { console.error('[DB] pinned_direct_messages migration error:', e.message); }
console.log('[DB] Migration: pinned_messages table ready');
} catch (e) { console.error('[DB] pinned_messages migration error:', e.message); }
console.log('[DB] Schema initialized');
return db;