Skip to main content

Database Schema

The tables in Hrida.ai's database, grouped by area: where the database lives, a map of every table, the columns of the core tables, and encryption.

Hrida.ai keeps users, chats, files, knowledge bases, settings and everything else in one relational database: SQLite by default, or PostgreSQL when you set DATABASE_URL. Both use the same tables, created and upgraded by migrations when Hrida.ai starts.

Use this page to plan backups, write reports, or debug a deployment.

Read, don't write

Change data through the UI or the API, not with SQL. Columns change between releases, and the application keeps related tables, caches and the vector store in step that a direct write would skip. Back up the database before any manual change.

Where the Database Lives​

DeploymentLocation
Docker (SQLite)/app/backend/data/hridaai.db inside the container, on the hrida-ai volume
Python / pip (SQLite)hridaai.db in the data directory (DATA_DIR)
PostgreSQLThe database named in DATABASE_URL

The data directory holds more than the database:

/app/backend/data
├── hridaai.db      # the database (SQLite)
├── uploads/        # uploaded files
├── vector_db/      # the default vector store (ChromaDB)
└── cache/          # downloaded models and other caches

To copy the SQLite database out of a running container:

bash
docker cp hrida-ai:/app/backend/data/hridaai.db ./hridaai.db

Open the copy, not the live file, with any SQLite client. For example, to list the tables:

bash
sqlite3 ./hridaai.db ".tables"

Conventions​

  • IDs are text, usually UUIDs. config is the exception, with an integer ID.
  • Timestamps are Unix epoch integers. The unit depends on the table: seconds in most tables, nanoseconds in the channel, message, calendar, note and automation tables. Each table below says which.
  • JSON columns store structured data: TEXT in SQLite, JSON in PostgreSQL.
  • Columns are nullable unless marked NOT NULL.
  • Ownership: user_id refers to user.id, but most tables don't declare it as a foreign key.
  • Sharing is stored in access_grant, not in the shared resource's own row.

Tables at a Glance​

Users & Access​

TableHolds
userUser profiles, roles and preferences
authSign-in credentials (password hashes)
api_keyPersonal API keys
oauth_sessionOAuth tokens from SSO sign-ins
groupUser groups and their permissions
group_memberGroup membership
access_grantWho may read or edit each shared resource
usage_limitToken and cost limits per user or group

Chats​

TableHolds
chatConversations, with the full message tree
chat_messageChat messages as rows, for queries and analytics
chat_fileFiles attached in chats
shared_chatSnapshots behind share links
folderChat folders
tagChat tags
feedbackRatings and feedback on answers
memorySaved memories used for personalization

Channels​

TableHolds
channelChannels and direct-message groups
channel_memberChannel membership and read state
channel_fileFiles posted in channels
channel_webhookIncoming webhooks that post to channels
messageChannel messages and threads
message_reactionReactions to channel messages

Files & Knowledge​

TableHolds
fileUploaded files and their metadata
knowledgeKnowledge bases
knowledge_fileFiles in each knowledge base

Models, Prompts, Tools & Skills​

TableHolds
modelWorkspace models (presets on top of base models)
model_pricingToken prices per model, for cost reports
promptPrompt templates (/ commands)
prompt_historyPrompt versions
toolTools (Python toolkits)
functionFunctions: filters, actions and pipes
skillSkills (Markdown instructions)
skill_historySkill versions
office_skills_bundleUploaded Office skills bundles

Notes, Calendar & Automations​

TableHolds
noteNotes
pinned_noteNotes each user pinned
calendarCalendars
calendar_eventCalendar events
calendar_event_attendeeEvent invitations and RSVPs
automationScheduled automations
automation_runAutomation run history

Artifacts​

TableHolds
artifactArtifacts (documents, decks, designs) and their content
artifact_assetImages and files used by artifacts
artifact_commentComments on artifacts
artifact_jobBackground jobs that build or convert artifacts
shared_artifactSnapshots behind artifact share links

Spaces, Projects & Boards​

TableHolds
spaceSpaces: shared workspaces inside an agent catalog
space_memberSpace membership and roles
projectProjects with their own instructions
workcast_boardTask boards
workcast_board_memberBoard members (users or groups)
workcast_taskTasks on boards
workcast_task_activityTask change history

Agent Builder & Workflows​

TableHolds
agent_workflowAgent Builder workflows and their graphs
workflow_versionPublished workflow versions (snapshots)
agent_lifecycle_eventWorkflow lifecycle transitions (submit, approve, publish)
approval_matrixApproval stages required for a workflow
approval_stage_recordProgress of each approval stage
workflow_runWorkflow runs, with saved state for paused runs
workflow_execution_logStep-by-step log of each workflow run
run_timelineTimeline events streamed during a run
workflow_triggerSchedules, webhooks and events that start workflows
workflow_test_caseSaved test inputs and expected outputs for workflows
inbox_taskHuman review tasks raised by workflows
agent_skillAgent skills: reusable agent definitions for workflows
skill_execution_logOne row per agent-skill call, for analytics
digital_employeeDigital employees (named agent roles)
business_eventBusiness events published to workflows
saga_definitionMulti-step sagas triggered by business events
saga_instanceRunning or finished sagas
saga_stepSteps of each saga, with compensation state
audit_logConfiguration changes to Agent Builder resources

Agent Catalogs & Data Sources​

TableHolds
catalogAgent catalogs: model providers, policies and settings
catalog_secretEncrypted secrets stored in a catalog
catalog_quotaMonthly token, cost and run limits per catalog
workflow_run_costTokens and cost of each workflow run
consumer_orgConsumer organizations in a catalog
agent_datasourceDatabase connections for agents (data sources)
datasource_session_tokenShort-lived dsq_ tokens for data-source access from terminals
datasource_query_logQueries run against data sources
incident_providerIncident management integrations
computer_tokenScoped cpk_ tokens for each user's Computer

API Platform​

TableHolds
api_catalogAPI catalogs
api_spaceAPI spaces inside a catalog
api_space_memberAPI space membership
api_definitionAPIs: OpenAPI spec, upstream, auth and gateway policy
api_definition_versionAPI versions (snapshots)
api_lifecycle_eventAPI lifecycle transitions
api_gatewayGateways that serve published APIs
api_environmentEnvironments (e.g. test, production)
api_publicationWhich APIs are published to which spaces
api_consumer_keyKeys for API consumers, with quotas and IP rules
api_protocol_mapperSOAP/XML protocol mapping per operation
api_message_mapperRequest and response transforms per operation
api_gateway_callGateway call log
api_gateway_call_captureCaptured request and response details for debugging
api_gateway_call_rollupCall statistics per time bucket
api_gateway_call_archiveArchived call logs (per day)
api_gateway_jobLocks and status of gateway background jobs
api_alert_ruleAlert rules on API metrics
api_alert_eventFired and resolved API alerts
api_assistant_chatAPI assistant conversations
api_assistant_chat_messageMessages in API assistant conversations

Email, Messaging & Meetings​

TableHolds
email_accountConnected mailboxes (IMAP/SMTP, CalDAV)
email_triage_cacheTriaged emails with summaries and drafts
email_draftEmail drafts
messaging_accountConnected messaging accounts
messaging_message_cacheReceived messages with summaries
meeting_configMeeting provider settings
meeting_sessionMeetings and their recordings
meeting_noteMeeting transcripts, summaries and action items

Administration & System​

TableHolds
configPersistent admin settings
admin_assistant_chatAdmin assistant conversations
admin_assistant_chat_messageMessages in admin assistant conversations
admin_assistant_actionChanges proposed and applied by the admin assistant

Other Tables​

TableHolds
alembic_versionThe current migration revision. Don't edit it.
document_chunkVector embeddings, only when VECTOR_DB is pgvector or opengauss
document, chatidtagLegacy tables from early releases, kept by the migrations. No longer used.

Tables outside the core set below are documented by their models in the Studio source, backend/hrida_ai_studio/models/.

Core Tables​

The columns below are read from the application's data models. Constraints added only by migrations, such as some unique constraints, are listed under each table.

Users & Access​

User​

user: User profiles, roles and preferences. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idStringPRIMARY KEYUnique identifier
emailString—User's email
usernameString(50)—Username (optional)
roleString—User's role
nameString—User's name
profile_image_urlText—Profile image path
profile_banner_image_urlText—Profile banner image path
bioText—User's biography
genderText—User's gender
date_of_birthDate—User's date of birth
timezoneString—IANA time zone, e.g. Europe/Berlin
presence_stateString—Presence shown to other users
status_emojiString—Custom status emoji
status_messageText—Custom status text
status_expires_atBigInteger—When the custom status clears
infoJSON—Additional user info
settingsJSON—User preferences
oauthJSON—Linked OAuth identities, per provider
scimJSON—SCIM provisioning data
last_active_atBigInteger—Last activity timestamp
updated_atBigInteger—Last update timestamp
created_atBigInteger—Creation timestamp
  • One-to-one with auth (same id).
  • API keys live in the api_key table, and linked OAuth identities in the oauth column; both replaced earlier columns on this table.
  • scim holds the externalId per identity provider from SCIM provisioning, for example {"okta": {"external_id": "def-456"}}. Lookups by externalId fall back to the OAuth identity when no SCIM entry matches.

Auth​

auth: Sign-in credentials (password hashes).

ColumnTypeConstraintsDescription
idStringPRIMARY KEYUnique identifier
emailString—User's email
passwordText—Hashed password
activeBoolean—Account status
  • One-to-one with user (same id). password is a hash, never the password itself.

API Key​

api_key: Personal API keys. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
user_idTextNOT NULLOwner of the key
keyTextNOT NULL, UNIQUEThe key value (sk-…)
dataJSON—Additional key data
expires_atBigInteger—Expiry time (null: never)
last_used_atBigInteger—Last time the key authenticated a request
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp

OAuth Session​

oauth_session: OAuth tokens from SSO sign-ins. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique session identifier
user_idTextNOT NULLAssociated user
providerTextNOT NULLOAuth provider (e.g., 'google')
tokenTextNOT NULLOAuth session token
expires_atBigIntegerNOT NULLToken expiration timestamp
created_atBigIntegerNOT NULLSession creation timestamp
updated_atBigIntegerNOT NULLSession last update timestamp
  • token is a JSON string with the access, ID and refresh tokens. Indexed on user_id, expires_at and (user_id, provider).

Group​

group: User groups and their permissions. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText—Group owner/creator
nameText—Group name
descriptionText—Group description
dataJSON—Additional group data
metaJSON—Group metadata
permissionsJSON—Permission configuration
created_atBigInteger—Creation timestamp
updated_atBigInteger—Last update timestamp

Group Member​

group_member: Group membership. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
group_idTextFK → group.id (cascade), NOT NULLReference to the group
user_idTextNOT NULLReference to the user
created_atBigInteger—Creation timestamp
updated_atBigInteger—Last update timestamp
  • Unique on (group_id, user_id). Deleting a group deletes its members.

Access Grant​

access_grant: Who may read or edit each shared resource. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
resource_typeTextNOT NULLType of resource (e.g., model, knowledge, tool)
resource_idTextNOT NULLID of the specific resource
principal_typeTextNOT NULLType of grantee: user or group
principal_idTextNOT NULLID of the user or group (or * for public)
permissionTextNOT NULLPermission level: read or write
created_atBigIntegerNOT NULLGrant creation timestamp
  • One row per grant, for every shareable resource: resource_type is for example model, knowledge, tool, prompt, note, channel, file, skill, calendar or shared_chat.
  • principal_type is user or group; a user grant with principal_id * means public access.
  • Unique on (resource_type, resource_id, principal_type, principal_id, permission), and indexed by resource and by principal.

Usage Limit​

usage_limit: Token and cost limits per user or group. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
scopeTextNOT NULLuser or group
scope_idTextNOT NULLThe user or group ID
limit_typeTextNOT NULLtokens or cost_usd
limit_valueNumeric(18, 8)NOT NULLThe limit
periodTextNOT NULLdaily or monthly
hard_limitBooleanNOT NULL, default TrueBlock requests over the limit (False: warn only)
alert_threshold_pctTextNOT NULL, default 80Percentage of the limit that triggers an alert (stored as text)
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
  • Unique on (scope, scope_id, limit_type, period). See Usage Limits.

Chats​

Chat​

chat: Conversations, with the full message tree. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idStringPRIMARY KEYUnique identifier (UUID)
user_idString—Owner of the chat
titleText—Chat title
chatJSON—Chat content and history
created_atBigInteger—Creation timestamp
updated_atBigInteger—Last update timestamp
share_idTextUNIQUESharing identifier
archivedBooleandefault FalseArchive status
pinnedBooleandefault FalsePin status
metaJSONdefault {}Metadata including tags
folder_idText—Parent folder ID
tasksJSON—Chat-level task/todo list used by agentic workflows
summaryText—Optional chat summary text
last_read_atBigInteger—Last read timestamp used for unread indicators
  • chat holds the full conversation tree as JSON; chat_message holds the same messages as rows for queries and analytics.
  • tasks and summary back the task list and summary shown in agentic chats. last_read_at drives the unread marker in the sidebar.
  • share_id is the shared_chat.id of the chat's active share link.

Chat Message​

chat_message: Chat messages as rows, for queries and analytics. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYMessage ID
chat_idTextFK → chat.id (cascade), NOT NULL, indexedChat the message belongs to
user_idTextindexedOwner of the chat
roleTextNOT NULLuser, assistant or system
parent_idText—Previous message in the branch
contentJSON—Message content: text or a list of content blocks
outputJSON—Structured output items (reasoning, tool calls, …)
model_idTextindexedModel that wrote the message (assistant messages)
filesJSON—Attachments
sourcesJSON—Citations and retrieved sources
embedsJSON—Embedded UI content
doneBooleandefault TrueWhether generation finished
status_historyJSON—Status updates shown during generation
errorJSON—Error details, if generation failed
usageJSON—Token counts and timing
created_atBigIntegerindexedCreation timestamp
updated_atBigInteger—Last update timestamp
  • Indexed on (chat_id, parent_id), (model_id, created_at) and (user_id, created_at). Deleting a chat deletes its messages.

Chat File​

chat_file: Files attached in chats. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idTextNOT NULLUser associated with the file
chat_idTextFK → chat.id (cascade), NOT NULLReference to the chat
message_idText—Reference to associated message
file_idTextFK → file.id (cascade), NOT NULLReference to the file
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
  • Unique on (chat_id, file_id). Lets Studio find a chat's files without reading every message, and stays consistent across nodes.

Shared Chat​

shared_chat: Snapshots behind share links. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYShare token (UUID) used in /s/{id} URLs
chat_idTextFK → chat.id (cascade), NOT NULLReference to the original chat
user_idTextNOT NULLUser who created the share
titleText—Chat title at time of sharing
chatJSON—Snapshot of chat content at share time
created_atBigInteger—Share creation timestamp
updated_atBigInteger—Last re-snapshot timestamp
  • Each row is a snapshot of the chat when it was shared; Update and Copy Link refreshes it. Deleting the chat deletes the snapshot.
  • Who may open a share link is stored in access_grant (resource_type = 'shared_chat').

Folder​

folder: Chat folders. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
parent_idText—Parent folder ID for hierarchy
user_idText—Owner of the folder
nameText—Folder name
itemsJSON—Folder contents
metaJSON—Folder metadata
dataJSON—Additional folder data
is_expandedBooleandefault FalseUI expansion state
created_atBigInteger—Creation timestamp
updated_atBigInteger—Last update timestamp
  • Folders nest through parent_id; root folders have none.

Tag​

tag: Chat tags.

ColumnTypeConstraintsDescription
idStringPRIMARY KEY (composite)Normalized tag identifier (part of the primary key)
nameString—Display name
user_idStringPRIMARY KEY (composite)Tag owner (part of the primary key)
metaJSON—Tag metadata
  • The primary key is (id, user_id): each user has their own tags.

Feedback​

feedback: Ratings and feedback on answers. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText—User who provided feedback
versionBigIntegerdefault 0Feedback version number
typeText—Type of feedback
dataJSON—Feedback data including ratings
metaJSON—Metadata (arena, chat_id, etc)
snapshotJSON—Associated chat snapshot
created_atBigInteger—Creation timestamp
updated_atBigInteger—Last update timestamp

Memory​

memory: Saved memories used for personalization. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idStringPRIMARY KEYUnique identifier (UUID)
user_idStringindexedMemory owner
contentText—Memory content
updated_atBigInteger—Last update timestamp
created_atBigInteger—Creation timestamp

Channels​

Channel​

channel: Channels and direct-message groups. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText—Owner/creator of channel
typeText—Channel type
nameText—Channel name
descriptionText—Channel description
is_privateBoolean—Private group channel
dataJSON—Flexible data storage
metaJSON—Channel metadata
created_atBigInteger—Creation timestamp (nanoseconds)
updated_atBigInteger—Last update timestamp (nanoseconds)
updated_byText—User who last changed the channel
archived_atBigInteger—When the channel was archived
archived_byText—User who archived it
deleted_atBigInteger—When the channel was deleted (soft delete)
deleted_byText—User who deleted it
  • Channel names are stored in lowercase. Deleting a channel is a soft delete (deleted_at).

Channel Member​

channel_member: Channel membership and read state. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier for the channel membership
channel_idTextNOT NULLReference to the channel
user_idTextNOT NULLReference to the user
roleText—Member role, e.g. manager
statusText—Membership status, e.g. joined or left
is_activeBooleanNOT NULL, default TrueWhether the membership is active
is_channel_mutedBooleanNOT NULL, default FalseMember muted the channel
is_channel_pinnedBooleanNOT NULL, default FalseMember pinned the channel
dataJSON—Additional data
metaJSON—Metadata
invited_atBigInteger—When the member was invited
invited_byText—User who invited them
joined_atBigInteger—When the member joined
left_atBigInteger—When the member left
last_read_atBigInteger—Last read position, for unread counts
created_atBigInteger—Timestamp when membership was created
updated_atBigInteger—Last update timestamp
  • Unique on (channel_id, user_id).

Channel File​

channel_file: Files posted in channels. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idTextNOT NULLOwner of the relationship
channel_idTextFK → channel.id (cascade), NOT NULLReference to the channel
message_idTextFK → message.id (cascade)Reference to associated message
file_idTextFK → file.id (cascade), NOT NULLReference to the file
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
  • Unique on (channel_id, file_id). Deleting the channel, file or message deletes the link.

Channel Webhook​

channel_webhook: Incoming webhooks that post to channels. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
channel_idTextNOT NULLChannel the webhook posts to
user_idTextNOT NULLUser who created it
nameTextNOT NULLName shown as the message author
profile_image_urlText—Avatar shown on its messages
tokenTextNOT NULLSecret token in the webhook URL
last_used_atBigInteger—Last time it posted
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp

Message​

message: Channel messages and threads. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText—Message author
channel_idText—Associated channel
reply_to_idText—Message this one quotes in a reply
parent_idText—Parent message for threads
is_pinnedBooleanNOT NULL, default FalsePinned in the channel
pinned_atBigInteger—When it was pinned
pinned_byText—User who pinned it
contentText—Message content
dataJSON—Additional message data
metaJSON—Message metadata
created_atBigInteger—Creation timestamp (nanoseconds)
updated_atBigInteger—Last update timestamp (nanoseconds)
  • Indexed for the channel timeline, pinned messages and thread replies. parent_id is the thread root; reply_to_id a quoted message.

Message Reaction​

message_reaction: Reactions to channel messages. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText—User who reacted
message_idText—Associated message
nameText—Reaction name/emoji
created_atBigInteger—Reaction timestamp

Files & Knowledge​

File​

file: Uploaded files and their metadata. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idStringPRIMARY KEYUnique identifier
user_idString—Owner of the file
hashText—File hash/checksum
filenameText—Name of the file
pathText—File system path
dataJSON—File-related data
metaJSON—File metadata
created_atBigInteger—Creation timestamp
updated_atBigInteger—Last update timestamp
deleted_atBigInteger—When the file was deleted (soft delete)
deleted_byText—User who deleted it
  • meta holds name, content_type and size (bytes), plus any extra keys.

Knowledge​

knowledge: Knowledge bases. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText—Knowledge base owner
space_idTextFK → space.id (set null), indexedSpace it belongs to (null when personal)
nameText—Knowledge base name
descriptionText—Knowledge base description
metaJSON—Additional metadata
chunk_strategyString—Chunking override: character, token or markdown (null: global setting)
chunk_sizeInteger—Chunk size override (null: global setting)
chunk_overlapInteger—Chunk overlap override (null: global setting)
created_atBigInteger—Creation timestamp
updated_atBigInteger—Last update timestamp

Knowledge File​

knowledge_file: Files in each knowledge base. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
knowledge_idTextFK → knowledge.id (cascade), NOT NULLReference to the knowledge base
file_idTextFK → file.id (cascade), NOT NULLReference to the file
user_idTextNOT NULLOwner of the relationship
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
  • Unique on (knowledge_id, file_id). Deleting the knowledge base or the file deletes the link.

Models, Prompts, Tools & Skills​

Model​

model: Workspace models (presets on top of base models). Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYModel identifier
user_idText—Model owner
base_model_idText—Parent model reference
nameText—Display name
paramsJSON—Model parameters
metaJSON—Model metadata
is_activeBooleandefault TrueActive status
updated_atBigInteger—Last update timestamp
created_atBigInteger—Creation timestamp

Model Pricing​

model_pricing: Token prices per model, for cost reports. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
model_idTextNOT NULL, UNIQUE, indexedModel the price applies to
providerText—Provider name
input_cost_per_millionNumeric(18, 8)NOT NULL, default 0Price per 1,000,000 input tokens
output_cost_per_millionNumeric(18, 8)NOT NULL, default 0Price per 1,000,000 output tokens
currencyTextNOT NULL, default USDCurrency code
is_activeBooleanNOT NULL, default TrueWhether the price is used
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp

Prompt​

prompt: Prompt templates (/ commands). Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
commandStringUNIQUE, indexedUnique command identifier
user_idString—Owner of the prompt
space_idTextFK → space.id (set null), indexedSpace it belongs to (null when personal)
nameText—Display name of the prompt
contentText—Prompt content/template
dataJSON—Additional prompt data
metaJSON—Prompt metadata
tagsJSON—Associated tags
is_activeBooleandefault TrueActive status
version_idText—Active entry in prompt_history
created_atBigInteger—Creation timestamp
updated_atBigInteger—Last update timestamp

Prompt History​

prompt_history: Prompt versions. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
prompt_idTextNOT NULL, indexedReference to the prompt
parent_idText—Reference to the parent version
snapshotJSONNOT NULLSnapshot of the prompt at version
user_idTextNOT NULLUser who created the version
commit_messageText—Version commit message
created_atBigIntegerNOT NULLCreation timestamp

Tool​

tool: Tools (Python toolkits). Timestamps are in seconds.

ColumnTypeConstraintsDescription
idStringPRIMARY KEYUnique identifier
user_idString—Tool owner
space_idStringFK → space.id (set null), indexedSpace it belongs to (null when personal)
nameText—Tool name
contentText—Tool content/code
specsJSON—Tool specifications
metaJSON—Tool metadata
valvesJSON—Tool control settings
updated_atBigInteger—Last update timestamp
created_atBigInteger—Creation timestamp

Function​

function: Functions: filters, actions and pipes. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idStringPRIMARY KEYUnique identifier
user_idString—Owner of the function
nameText—Function name
typeText—filter, action or pipe
contentText—Function content/code
metaJSON—Function metadata
valvesJSON—Function control settings
is_activeBoolean—Function active status
is_globalBoolean—Global availability flag
updated_atBigInteger—Last update timestamp
created_atBigInteger—Creation timestamp
  • Global functions (is_global) apply to every model; others only where they are enabled on a model.

Skill​

skill: Skills (Markdown instructions). Timestamps are in seconds.

ColumnTypeConstraintsDescription
idStringPRIMARY KEYUnique identifier (UUID)
user_idString—Owner/creator of the skill
space_idStringFK → space.id (set null), indexedSpace it belongs to (null when personal)
nameTextUNIQUEDisplay name of the skill
descriptionText—Short description (used in manifest)
contentText—Full skill instructions (Markdown)
metaJSON—Skill metadata
is_activeBooleandefault TrueActive status
version_idText—Active entry in skill_history
updated_atBigInteger—Last update timestamp
created_atBigInteger—Creation timestamp
  • description goes into the system prompt as part of the skills list; content is loaded when the model calls view_skill.

Skill History​

skill_history: Skill versions. Timestamps are in seconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
skill_idTextNOT NULL, indexedThe skill
parent_idText—Previous version
snapshotJSONNOT NULLThe skill as it was at this version
user_idTextNOT NULLUser who saved the version
commit_messageText—Version note
created_atBigIntegerNOT NULLCreation timestamp

Notes, Calendar & Automations​

Note​

note: Notes. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
user_idText—Owner of the note
titleText—Note title
dataJSON—Note content and data
metaJSON—Note metadata
created_atBigInteger—Creation timestamp
updated_atBigInteger—Last update timestamp
  • Pins are per user, in pinned_note; pinning doesn't change note.updated_at.

Pinned Note​

pinned_note: Notes each user pinned. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idTextNOT NULLThe user who pinned the note
note_idTextFK → note.id (cascade), NOT NULLThe pinned note
created_atBigIntegerNOT NULLPin creation timestamp (used for ordering)
  • Unique on (user_id, note_id); listed newest pin first. Deleting the note deletes its pins.

Calendar​

calendar: Calendars. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idTextNOT NULLOwner of the calendar
nameTextNOT NULLCalendar display name
colorText—Display color (hex, e.g. #3b82f6)
is_defaultBooleanNOT NULL, default FalseWhether this is the user's default calendar
dataJSON—Extensible data payload
metaJSON—Optional metadata
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
  • A default Personal calendar is created on first use. Only non-default calendars can be deleted, and deleting one deletes its events, attendees and grants.
  • The Scheduled Tasks calendar is not stored: the API builds it from automations at request time (ID __scheduled_tasks__).

Calendar Event​

calendar_event: Calendar events. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
calendar_idTextNOT NULLReference to parent calendar
user_idTextNOT NULLUser who created the event
titleTextNOT NULLEvent title
descriptionText—Event description
start_atBigIntegerNOT NULLStart time (epoch nanoseconds)
end_atBigInteger—End time (epoch nanoseconds)
all_dayBooleanNOT NULL, default FalseWhether this is an all-day event
rruleText—ICalendar RRULE for recurrence
colorText—Per-event color override
locationText—Event location
dataJSON—Extensible data payload
metaJSON—Optional metadata (e.g. automation_id)
is_cancelledBooleanNOT NULL, default FalseSoft-cancel flag
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
  • Recurring events store an rrule and are expanded into instances when queried. Cancelled events stay in the table but are left out of queries.

Calendar Event Attendee​

calendar_event_attendee: Event invitations and RSVPs. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
event_idTextNOT NULLReference to the calendar event
user_idTextNOT NULLUser invited to the event
statusTextNOT NULL, default pendingRSVP status: pending, accepted, declined, tentative
metaJSON—Optional metadata
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
  • Unique on (event_id, user_id). status is pending, accepted, declined or tentative.

Automation​

automation: Scheduled automations. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idTextNOT NULLOwner of the automation
space_idTextFK → space.id (set null), indexedSpace it belongs to (null when personal)
nameTextNOT NULLAutomation display name
dataJSONNOT NULLAutomation payload (prompt, model_id, rrule, optional terminal config)
metaJSON—Optional metadata
is_activeBooleanNOT NULL, default TrueActive/paused state
last_run_atBigInteger—Last run time
next_run_atBigInteger—Next scheduled run time
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
  • data holds the prompt, model, rrule and optional terminal settings. next_run_at is indexed for the scheduler.

Automation Run​

automation_run: Automation run history. Timestamps are in nanoseconds.

ColumnTypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
automation_idTextNOT NULLReference to automation
chat_idText—Chat created by this run (if available)
statusTextNOT NULLsuccess, error or skipped
errorText—Error details when status is error
deliveryJSON—How the report was delivered, e.g. by email (null: none requested)
artifactsJSON—Report files the run wrote, copied into Studio files
created_atBigIntegerNOT NULLRun record timestamp
  • Deleting an automation deletes its runs.

System​

Config​

config: Persistent admin settings.

ColumnTypeConstraintsDescription
idIntegerPRIMARY KEYPrimary key identifier
dataJSONNOT NULLConfiguration data
versionIntegerNOT NULL, default 0Config version number
created_atDateTimeNOT NULL, default nowCreation timestamp
updated_atDateTime—Last update timestamp
  • A single row holds the persistent admin settings as JSON. Values saved here take precedence over environment variables, unless ENABLE_PERSISTENT_CONFIG=False.

Entity Relationships​

How the core tables relate. Most tables also have a user_id owner, left out here for readability.

access_grant links any resource (model, knowledge base, tool, prompt, note, channel, file, skill, calendar, shared chat) to a user or group, through resource_type + resource_id and principal_type + principal_id.

Encrypting SQLite with SQLCipher​

Hrida.ai can encrypt the SQLite database at rest with SQLCipher, for deployments with sensitive data that don't need PostgreSQL.

Prerequisites​

SQLCipher needs dependencies that are not in the default image:

  • the SQLCipher system library (libsqlcipher-dev on Debian/Ubuntu, sqlcipher on macOS with Homebrew);
  • the sqlcipher3-wheels Python package (pip install sqlcipher3-wheels).

For Docker, build a custom image that adds them.

Configuration​

bash
# Use SQLCipher for the database
DATABASE_TYPE=sqlite+sqlcipher

# The encryption password
DATABASE_PASSWORD=your-secure-password

When these are set and DATABASE_URL is not, Hrida.ai creates and uses an encrypted database at ./data/hridaai.db.

Keep the password safe
  • DATABASE_PASSWORD is required with sqlite+sqlcipher.
  • Anyone with the password can read all application data, so store it in a secrets manager.
  • Losing the password means losing all data in the encrypted database.
Existing data is not migrated

Hrida.ai can't convert an existing unencrypted database to SQLCipher. If you turn SQLCipher on for an existing installation, it can't read the old data. Instead, either:

  1. Start fresh on a new installation, and have users export and re-import their chats;
  2. Migrate by hand with SQLite/SQLCipher tools, exporting from the old database into a new encrypted one (advanced);
  3. Encrypt the disk instead, with LUKS (Linux) or BitLocker (Windows), with no database change;
  4. Switch to PostgreSQL with TLS and encrypted storage, which also suits multi-user deployments.

Database Settings​

VariableDefaultDescription
DATABASE_URLSQLite in DATA_DIRDatabase connection URL, e.g. postgresql://user:pass@host:5432/hridaai
DATABASE_TYPENonesqlite+sqlcipher for encrypted SQLite
DATABASE_PASSWORD—Encryption password (required for SQLCipher)
DATABASE_ENABLE_SQLITE_WALTrueWrite-ahead logging, for better concurrency
DATABASE_SQLITE_PRAGMA_SYNCHRONOUSNORMALSQLite sync mode (safe with WAL; avoids an fsync per transaction)
DATABASE_SQLITE_PRAGMA_BUSY_TIMEOUT5000How long a write waits for a lock, in milliseconds
DATABASE_SQLITE_PRAGMA_CACHE_SIZE-65536Page cache size (negative = KiB; about 64 MB)
DATABASE_SQLITE_PRAGMA_TEMP_STOREMEMORYKeep temporary tables in RAM
DATABASE_SQLITE_PRAGMA_MMAP_SIZE268435456Memory-mapped I/O size in bytes (about 256 MB)
DATABASE_SQLITE_PRAGMA_JOURNAL_SIZE_LIMIT67108864Largest WAL file kept after a checkpoint (about 64 MB)
DATABASE_POOL_SIZENoneConnection pool size
DATABASE_POOL_TIMEOUT30Seconds to wait for a pooled connection
DATABASE_POOL_RECYCLE3600Seconds before a pooled connection is replaced

For every database variable, see Environment Variable Configuration.

Hrida.ai is proprietary software of Zlabs Innovation. See the license for terms. © 2026 Zlabs Innovation.