- 003_add_server_tables.sql: server_orders, server_instances tables - 003_server_sessions.sql: KV-based session tracking - 004_add_terminated_at.sql: track instance termination time Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
18 lines
566 B
SQL
18 lines
566 B
SQL
-- Server consultation sessions table
|
|
CREATE TABLE IF NOT EXISTS server_sessions (
|
|
user_id TEXT PRIMARY KEY,
|
|
status TEXT NOT NULL DEFAULT 'gathering',
|
|
collected_info TEXT, -- JSON
|
|
last_recommendation TEXT, -- JSON
|
|
messages TEXT, -- JSON
|
|
created_at INTEGER NOT NULL,
|
|
updated_at INTEGER NOT NULL,
|
|
expires_at INTEGER NOT NULL
|
|
);
|
|
|
|
-- Index for cleanup job
|
|
CREATE INDEX IF NOT EXISTS idx_sessions_expires ON server_sessions(expires_at);
|
|
|
|
-- Index for status queries
|
|
CREATE INDEX IF NOT EXISTS idx_sessions_status ON server_sessions(user_id, status);
|