-- VTM conversation states table

CREATE TABLE IF NOT EXISTS conversation_states (
    session_id VARCHAR(255) PRIMARY KEY,
    user_id UUID,
    workflow VARCHAR(50),
    step VARCHAR(50),
    context JSONB,
    created_at TIMESTAMP DEFAULT NOW(),
    updated_at TIMESTAMP DEFAULT NOW(),
    expires_at TIMESTAMP
);

CREATE INDEX idx_conversation_user ON conversation_states(user_id);
CREATE INDEX idx_conversation_workflow ON conversation_states(workflow);
CREATE INDEX idx_conversation_expires ON conversation_states(expires_at);

