v3: chatbox improvements (typing indicators, answer to previous messages, backlog days separators, scroll to last message position, visual tweaks)
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 41s
This commit is contained in:
17
api/db/migrations/0009_chat_reply.ts
Normal file
17
api/db/migrations/0009_chat_reply.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { DatabaseSync } from "node:sqlite";
|
||||
|
||||
// Adds an optional self-reference so a chat message can reply to another.
|
||||
// Kept as a plain column (no FK): when the replied-to message is later deleted
|
||||
// the id is retained but the join yields null, letting the UI show a subtle
|
||||
// "deleted message" reference instead of breaking the insert.
|
||||
//
|
||||
// Idempotent: also runs against fresh databases created from schema.sql, where
|
||||
// the column already exists.
|
||||
export function up(db: DatabaseSync): void {
|
||||
const cols = db.prepare(`PRAGMA table_info(chat_messages);`).all() as {
|
||||
name: string;
|
||||
}[];
|
||||
if (!cols.some((c) => c.name === "reply_to_id")) {
|
||||
db.exec(`ALTER TABLE chat_messages ADD COLUMN reply_to_id TEXT;`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user