feat: persist chat messages to SQLite

Chat messages were ephemeral — lost on page refresh or late join.
Add a chat_messages table and load the last 50 messages on connect
so players see conversation history.
This commit is contained in:
Ryan Hamamura
2026-02-13 11:57:22 -10:00
parent 08c20a1732
commit 02212ffd61
6 changed files with 150 additions and 4 deletions

9
db/queries/chat.sql Normal file
View File

@@ -0,0 +1,9 @@
-- name: CreateChatMessage :exec
INSERT INTO chat_messages (game_id, nickname, color, message, created_at)
VALUES (?, ?, ?, ?, ?);
-- name: GetChatMessages :many
SELECT * FROM chat_messages
WHERE game_id = ?
ORDER BY created_at DESC, id DESC
LIMIT 50;