Перейти к основному содержимому

Table Definitions

Full column specifications for all tables in the orchestrator schema.

users

ColumnTypeConstraintsDescription
idUUIDPKUser identifier
subjectTEXTNOT NULL, UNIQUEAuth provider subject (Firebase UID or dev token)
emailTEXTNOT NULLUser email
nicknameTEXTNOT NULL, default ''Display nickname
nameTEXTNOT NULL, default ''First name
surnameTEXTNOT NULL, default ''Last name
avatar_urlTEXTNULLProfile avatar URL
country_codeTEXTNULLISO country code
date_of_birthTIMESTAMPTZNULLDate of birth
is_bannedBOOLEANNOT NULL, default falseBan flag
has_agreed_with_termsBOOLEANNOT NULL, default falseTerms acceptance
has_agreed_with_privacy_policyBOOLEANNOT NULL, default falsePrivacy acceptance
created_atTIMESTAMPTZNOT NULLCreation timestamp
updated_atTIMESTAMPTZNOT NULLLast update timestamp
deleted_atTIMESTAMPTZNULLSoft delete timestamp

Indexes: idx_users_subject on subject


user_preferences

ColumnTypeConstraintsDescription
user_idUUIDPK, FK -> users(id) CASCADEUser reference
platform_themeTEXTNULLUI theme preference
platform_languageTEXTNULLLanguage code
currency_codeTEXTNULLPreferred currency
updated_atTIMESTAMPTZNOT NULLLast update timestamp

user_push_tokens

ColumnTypeConstraintsDescription
user_idUUIDPK, FK -> users(id) CASCADEUser reference
push_tokenTEXTNOT NULLFCM token
updated_atTIMESTAMPTZNOT NULLLast update timestamp

workspaces

ColumnTypeConstraintsDescription
idUUIDPKWorkspace identifier
user_idUUIDNOT NULL, FK -> users(id) CASCADEOwner
nameTEXTNOT NULLWorkspace display name
created_atTIMESTAMPTZNOT NULLCreation timestamp
updated_atTIMESTAMPTZNOT NULLLast update timestamp

Indexes: idx_workspaces_user_id on user_id

Runtime status comes from UserSwarm.status in Kubernetes, not this table.


agents

ColumnTypeConstraintsDescription
idUUIDPKAgent identifier
workspace_idUUIDNOT NULL, FK -> workspaces(id) CASCADEParent workspace
nameTEXTNOT NULLAgent display name
roleTEXTNOT NULLAgent role (e.g. "default")
avatar_urlTEXTNOT NULL, default ''Agent avatar
sort_orderINTEGERNOT NULL, default 0Display order
created_atTIMESTAMPTZNOT NULLCreation timestamp
updated_atTIMESTAMPTZNOT NULLLast update timestamp

Indexes: idx_agents_workspace_role UNIQUE on (workspace_id, role), idx_agents_workspace_id on workspace_id


conversations

ColumnTypeConstraintsDescription
idUUIDPKConversation identifier
workspace_idUUIDNOT NULL, FK -> workspaces(id) CASCADEParent workspace
agent_idUUIDNULL, FK -> agents(id) SET NULLAssociated agent
typeTEXTNOT NULLConversation type
titleTEXTNOT NULLConversation title
unread_countINTEGERNOT NULL, default 0Unread message count
created_atTIMESTAMPTZNOT NULLCreation timestamp
updated_atTIMESTAMPTZNOT NULLLast update timestamp

Indexes: idx_conversations_workspace_id on workspace_id, idx_conversations_workspace_type on (workspace_id, type)


messages

ColumnTypeConstraintsDescription
idUUIDPKMessage identifier
conversation_idUUIDNOT NULL, FK -> conversations(id) CASCADEParent conversation
roleTEXTNOT NULLMessage role (user, assistant, system)
contentJSONBNOT NULLMessage content (structured)
statusTEXTNOT NULLMessage status
local_idTEXTNULLClient-generated ID for deduplication
agent_idUUIDNULL, FK -> agents(id) SET NULLAgent that sent/received
attachmentsJSONBNOT NULL, default '[]'File attachments
created_atTIMESTAMPTZNOT NULLCreation timestamp
updated_atTIMESTAMPTZNOT NULLLast update timestamp

Indexes: idx_messages_conversation_created_at on (conversation_id, created_at DESC, id DESC), idx_messages_local_id on local_id


mcp_audit_logs

Audit log for every MCP tool call made by ZeroClaw agent pods. Writes are async (goroutine with 5s timeout) to avoid response latency. Required for ISO 27001 compliance.

ColumnTypeConstraintsDescription
idUUIDPKAudit log identifier
user_idTEXTNOT NULLUser who triggered the tool call
workspace_idTEXTNOT NULLWorkspace context
session_idTEXTNULLMCP session identifier
tool_nameTEXTNOT NULLMCP tool name (e.g., send_push_notification)
inputJSONBNOT NULLTool call input parameters
outputJSONBNULLTool call output
api_callsJSONBNULLExternal API calls made during execution
successBOOLEANNOT NULLWhether the tool call succeeded
error_messageTEXTNULLError message on failure
duration_msINTEGERNOT NULLExecution time in milliseconds
remote_addrTEXTNULLCalling pod's IP address
created_atTIMESTAMPTZNOT NULLTimestamp of the tool call