Schema Definition
Theconversations table stores AI chat conversations within projects.
Fields
Unique conversation identifier
ID of the project this conversation belongs to
Conversation title (typically auto-generated based on first message)
Unix timestamp (in milliseconds) of last update
Indexes
Index on
projectId for retrieving all conversations in a projectFields: ["projectId"]Queries
getById
Retrieve a specific conversation by ID.Conversation identifier
"Conversation not found"- Conversation doesn’t exist"Project not found"- Associated project doesn’t exist"Unauthorized to access this project"- User is not the project owner
getByProject
Retrieve all conversations in a project.Project identifier
"Project not found"- Project doesn’t exist"Unauthorized to access this project"- User is not the owner
getMessages
Retrieve all messages in a conversation.Conversation identifier
"Conversation not found"- Conversation doesn’t exist"Project not found"- Associated project doesn’t exist"Unauthorized to access this project"- User is not the project owner
Mutations
create
Create a new conversation in a project.Project identifier
Conversation title
Id<'conversations'> - ID of the newly created conversation
Errors:
"Project not found"- Project doesn’t exist"Unauthorized to access this project"- User is not the project owner
Related Tables
Messages
Each conversation contains multiple messages. See the Messages schema for details.
Source Reference
- Schema definition:
convex/schema.ts:46-50 - Queries and mutations:
convex/conversations.ts