Schema Overview
Meridian’s Convex schema is defined inconvex/schema.ts. All tables are strongly typed with runtime validation using Convex validators.
The schema provides precise TypeScript types that are automatically generated in
convex/_generated/dataModel.d.ts.files
Stores metadata for uploaded CSV and JSON files with DuckDB processing status.Fields
Convex/R2 storage identifier for the uploaded file
Original filename (e.g.,
sales_data.csv)MIME type (e.g.,
text/csv, application/json)File size in bytes
User ID of the uploader
Unix timestamp (milliseconds) of upload time
Name of the DuckDB table created from this file
Whether the file has been successfully loaded into DuckDB
Indexes
by_uploadedBy- Query files by user
Example Usage
convex/csv.ts
insightsCache
Caches AI-generated insights to avoid redundant API calls for identical data.Fields
Hash of
tableName|query|columnCount|rowCount for cache lookupsDuckDB table name the insights are for
SQL query that produced the analyzed data
Secondary hash for data signature validation
Array of insight objects with structured findings
Full statistical analysis results including means, outliers, trends
Unix timestamp when insights were generated
User who generated the insights
Indexes
by_cacheKey- Fast cache lookupsby_userId- Query user’s cached insights
Example Usage
See Insights Cache API for detailed examples.queryLog
Tracks all SQL queries executed against DuckDB tables with execution metadata.Fields
The SQL query string executed (e.g.,
SELECT * FROM sales WHERE region = 'West')Unix timestamp (milliseconds) of execution time
User who executed the query
DuckDB table the query was executed against
Whether the query executed successfully
Error message if
success is falseGlobal sequence number for temporal ordering (used for rollback/replay)
Query result statistics
Indexes
by_userId- Query logs by userby_sequenceNumber- Temporal ordering for replayby_tableName- Query logs by tableby_userId_tableName- Combined filtering (most commonly used)
Example Usage
See Query Log API for detailed examples.agentThreads
Conversation threads for AI agents (Query Agent and Analysis Agent).Fields
User who owns this conversation thread
DuckDB table being analyzed in this thread
External thread ID from Convex Agent system
Name of the agent (e.g.,
Query Agent, Analysis Agent)Thread title (auto-generated from first user message)
Unix timestamp when thread was created
Unix timestamp of last update
Unix timestamp of last message (for sorting)
Preview of the last message (first 200 characters)
Mode of the last message:
query or analysisIndexes
by_agentThreadId- Lookup thread by external IDby_user_table- List threads for a user/table combinationby_user_table_lastMessageAt- Sorted thread list (most recent first)
Example Usage
convex/agent_utils.ts
agentMessages
Individual messages within agent conversation threads.Fields
Reference to the parent thread
Message sender:
user or assistantUser ID (only for user messages)
Agent name (only for assistant messages)
Message mode:
query (SQL generation) or analysis (data exploration)Full message content (user input or assistant response)
Summary or description of the response
SQL commands generated by Query Agent (array of strings)
Tool execution steps for Analysis Agent
Unix timestamp of message creation
Indexes
by_thread- Query all messages in a thread (chronologically)
Example Usage
convex/agent_utils.ts
notifications
Real-time activity notifications for collaborative features.Fields
DuckDB table the notification relates to
User who triggered the notification
Display name of the user
Avatar URL of the user
Notification type:
query, agent_query, agent_analysis, insights_generated, chart_createdHuman-readable notification message
Additional context data (e.g., query text, chart config)
Unix timestamp of notification creation
Indexes
by_tableName- Query notifications for a tableby_tableName_createdAt- Time-ordered notifications
Example Usage
convex/notifications.ts
Type Generation
Convex automatically generates TypeScript types from the schema:See Also
Query Log API
Query execution tracking system
Insights Cache
AI insights generation and caching
Convex Validators
Learn about Convex type validation