Add user_sessions table to database schema
This commit is contained in:
parent
660d7d436f
commit
dec65c39ff
2 changed files with 13 additions and 0 deletions
13
src/scripts/database/0003.sql
Normal file
13
src/scripts/database/0003.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS user_sessions (
|
||||||
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||||
|
user_id TEXT NOT NULL,
|
||||||
|
bot_id TEXT NOT NULL,
|
||||||
|
answer_mode TEXT NOT NULL DEFAULT 'direct',
|
||||||
|
context JSONB NOT NULL DEFAULT '{}',
|
||||||
|
current_tool TEXT,
|
||||||
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||||
|
UNIQUE(user_id, bot_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_user_sessions_user_bot ON user_sessions(user_id, bot_id);
|
||||||
0
test.rs
Normal file
0
test.rs
Normal file
Loading…
Add table
Reference in a new issue