auto-claude: subtask-4-4 - Create chat_sessions and chat_messages tables in Supabase
Create SQL migration for chatbot database tables: - chat_sessions: Stores visitor session data with visitor_id, metadata, timestamps - chat_messages: Stores chat messages with role (user/assistant/system), content - Proper indexes for visitor lookup and message ordering - Row Level Security (RLS) enabled with policies for: - Service role full access (for server-side API) - Visitor-based access via x-visitor-id header (for potential future client-side) - Trigger for automatic updated_at column on chat_sessions Also updated ChatSession interface in chat.ts to include updated_at field. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ export type ChatRole = 'user' | 'assistant' | 'system';
|
||||
export interface ChatSession {
|
||||
id: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
visitor_id: string;
|
||||
metadata: Record<string, unknown>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user