Files
wownerogue/src/migrations/006_chat_history.sql
T
jwinterm fad2a695bd Wownerogue
A browser-based roguelike synchronized with crypto block timing. A run is a race
against the next block: reach the exit before the block lands, or the house wins.
The same codebase runs the solo dungeon, the social Tavern, and operator-selected
PvP and race rulesets, with separate free and paid leaderboards.

Self-hostable under the MIT License. See README.md to run it, docs/ARCHITECTURE.md
for the design, and docs/DEPLOY.md to operate an instance.
2026-07-27 08:23:01 -04:00

23 lines
887 B
SQL

-- Chat History Migration
-- Persistent storage for chat messages
-- Create chat_messages table
CREATE TABLE IF NOT EXISTS chat_messages (
id SERIAL PRIMARY KEY,
socket_id VARCHAR(255),
username VARCHAR(50),
message TEXT NOT NULL,
message_type VARCHAR(20) DEFAULT 'chat', -- 'chat', 'system', 'event'
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Index for efficient retrieval of recent messages
CREATE INDEX IF NOT EXISTS idx_chat_messages_created_at ON chat_messages(created_at DESC);
-- Optional: Index for user-specific history lookups
CREATE INDEX IF NOT EXISTS idx_chat_messages_socket_id ON chat_messages(socket_id);
-- Comment on table
COMMENT ON TABLE chat_messages IS 'Stores chat message history for display to new users';
COMMENT ON COLUMN chat_messages.message_type IS 'Type of message: chat (user), system (server), event (game events)';