Skip to content

Schema: core

Part of the generated database reference.

auto_tasks

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.42-fix-auto-tasks-schema
  • Rust source: botschema/src/core/rbac_roles_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
bot_id UUID no β€” FK bots.id
session_id UUID yes β€” FK user_sessions.id
title VARCHAR(500) no β€” β€” β€”
intent TEXT no β€” β€” β€”
status VARCHAR(50) no 'pending' β€” β€”
execution_mode VARCHAR(50) no 'supervised' β€” β€”
priority VARCHAR(20) no 'normal' β€” β€”
plan_id UUID yes β€” β€” β€”
basic_program TEXT yes β€” β€” β€”
current_step INTEGER yes 0 β€” β€”
total_steps INTEGER yes 0 β€” β€”
progress FLOAT yes 0.0 β€” β€”
step_results JSONB yes '[]'::jsonb β€” β€”
manifest_json JSONB yes β€” β€” β€”
error TEXT yes β€” β€” β€”
started_at TIMESTAMPTZ yes β€” β€” β€”
completed_at TIMESTAMPTZ yes β€” β€” β€”
created_at TIMESTAMPTZ yes NOW() β€” β€”
updated_at TIMESTAMPTZ yes NOW() β€” β€”
branch_id UUID yes β€” FK branches.id
name VARCHAR(500) no '' β€” β€”
schedule VARCHAR(255) yes β€” β€” β€”
task_type VARCHAR(100) no 'scheduled' β€” β€”
config JSONB yes β€” β€” β€”
is_active BOOLEAN no TRUE β€” β€”
last_run_at TIMESTAMPTZ yes β€” β€” β€”

Indexes: idx_auto_tasks_manifest_json(manifest_json)

basic_tools

Stores compiled BASIC tools with their MCP and OpenAI tool definitions

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id TEXT no gen_random_uuid() PK β€”
bot_id TEXT no β€” β€” β€”
tool_name TEXT no β€” β€” β€”
file_path TEXT no β€” β€” β€”
ast_path TEXT no β€” β€” β€”
mcp_json TEXT yes β€” β€” β€”
tool_json TEXT yes β€” β€” β€”
compiled_at TEXT no NOW() β€” β€”
is_active INTEGER no TRUE β€” β€”
created_at TEXT no NOW() β€” β€”
updated_at TEXT no NOW() β€” β€”
branch_id UUID yes β€” FK branches.id

Drift: in migrations only: file_hash

bot_configuration

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
bot_id UUID no β€” FK bots.id
config_key TEXT no β€” β€” β€”
config_value TEXT no β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”
branch_id UUID yes β€” FK branches.id

Drift: in migrations only: config_type, is_encrypted

bot_memories

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
bot_id UUID no β€” FK bots.id
key TEXT no β€” β€” β€”
value TEXT no β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”
branch_id UUID yes β€” FK branches.id

bot_shared_memory

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
source_bot_id UUID no β€” FK bots.id
target_bot_id UUID no β€” FK bots.id
memory_key TEXT no β€” β€” β€”
memory_value TEXT no β€” β€” β€”
shared_at TIMESTAMPTZ no NOW() β€” β€”

bots

  • Domain: core Β· Feature gate: always available Β· Migration: 6.7.6-bots-flags-not-null
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
name VARCHAR(255) no β€” β€” β€”
description TEXT yes β€” β€” β€”
llm_provider VARCHAR(255) no β€” β€” β€”
llm_config JSONB no '{}'::jsonb β€” β€”
context_provider VARCHAR(255) no β€” β€” β€”
context_config JSONB no '{}'::jsonb β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”
is_active BOOLEAN yes TRUE β€” β€”
tenant_id UUID yes β€” β€” β€”
org_id UUID no β€” FK organizations.org_id
is_default boolean yes β€” β€” β€”
parent_bot_id UUID yes β€” FK bots.id
enabled_tabs_json TEXT yes '["chat"]' β€” β€”
inherit_parent_config BOOLEAN yes true β€” β€”
database_name VARCHAR(255) yes β€” β€” β€”
slug VARCHAR(255) no β€” β€” β€”
is_public BOOLEAN no FALSE β€” β€”
branch_id UUID no β€” FK branches.id
is_default_for_branch BOOLEAN no false β€” β€”
origin VARCHAR(16) no 'drive' β€” β€”

Indexes: idx_unified_search_bots(to_tsvector('english', COALESCE(name::text, '')

Drift: not found in migrations: is_default

branches

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
org_id UUID no β€” FK organizations.org_id
tenant_id UUID no β€” FK tenants.id
slug VARCHAR(255) no β€” β€” β€”
name VARCHAR(255) no β€” β€” β€”
description TEXT yes β€” β€” β€”
is_active BOOLEAN no TRUE β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

chat_preferences

  • Domain: core Β· Feature gate: always available Β· Migration: 6.8.2-chat-preferences
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
user_id UUID no β€” β€” β€”
bot_id UUID yes β€” β€” β€”
memory_key TEXT no β€” β€” β€”
memory_value TEXT no β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

Indexes: idx_chat_preferences_unique(user_id, COALESCE(bot_id, '00000000-0000-0000-0000-000000000000'::uuid)

clicks

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
campaign_id TEXT no β€” β€” β€”
email TEXT no β€” β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

kb_collections

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core/rbac_roles_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
bot_id UUID no β€” FK bots.id
name TEXT no β€” β€” β€”
folder_path TEXT no β€” β€” β€”
qdrant_collection TEXT no β€” β€” β€”
document_count INTEGER no 0 β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

kb_group_associations

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core/rbac_roles_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
kb_id UUID no β€” FK kb_collections.id
group_id UUID no β€” FK rbac_groups.id
granted_by UUID yes β€” FK users.id
granted_at TIMESTAMPTZ no NOW() β€” β€”

message_history

  • Domain: core Β· Feature gate: always available Β· Migration: 6.9.0-usage-engine-provider
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
session_id UUID no β€” FK user_sessions.id
user_id UUID no β€” FK users.id
role INTEGER no β€” β€” β€”
content_encrypted TEXT no β€” β€” β€”
message_type INTEGER no 0 β€” β€”
media_url text yes β€” β€” β€”
token_count int4 no 0 β€” β€”
processing_time_ms int4 yes β€” β€” β€”
llm_model varchar(100) yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
message_index INTEGER no β€” β€” β€”
run_id UUID yes β€” β€” β€”
thread_id TEXT yes β€” β€” β€”
llm_engine VARCHAR(20) yes β€” β€” β€”
llm_provider VARCHAR(60) yes β€” β€” β€”

Indexes: idx_message_history_created_at(created_at), idx_message_history_run(run_id), idx_message_history_session_id(session_id)

organization_invitations

Stores pending and historical organization invitations

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.56-persistent-invitations
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
org_id UUID no β€” FK organizations.org_id
email VARCHAR(255) no β€” β€” β€”
role VARCHAR(255) no 'member' β€” β€”
status VARCHAR(255) no 'pending' β€” β€”
message TEXT yes β€” β€” β€”
invited_by UUID no β€” FK users.id
token VARCHAR(255) yes β€” UQ β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ yes NOW() β€” β€”
expires_at TIMESTAMPTZ yes β€” β€” β€”
accepted_at TIMESTAMPTZ yes β€” β€” β€”
accepted_by UUID yes β€” FK users.id
branch_id UUID yes β€” FK branches.id
groups jsonb no β€” β€” β€”
invited_by_name varchar yes β€” β€” β€”

Drift: not found in migrations: groups, invited_by_name

organizations

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.19-org-domain
  • Rust source: botschema/src/core.rs
Column SQL type Null Default Key References
org_id UUID no gen_random_uuid() PK β€”
name TEXT no β€” β€” β€”
slug TEXT no β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at timestamptz no now() β€” β€”
tenant_id UUID no β€” FK tenants.id
domain VARCHAR(255) yes β€” β€” β€”

Indexes: idx_organizations_created_at(created_at), idx_organizations_slug(slug)

rbac_group_roles

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core/rbac_roles_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
group_id UUID no β€” FK rbac_groups.id
role_id UUID no β€” FK rbac_roles.id
granted_by UUID yes β€” FK users.id
granted_at TIMESTAMPTZ no NOW() β€” β€”

rbac_groups

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core/rbac_roles_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
name VARCHAR(255) no β€” UQ β€”
display_name VARCHAR(255) no β€” β€” β€”
description TEXT yes β€” β€” β€”
parent_group_id UUID yes β€” FK rbac_groups.id
is_active BOOLEAN no TRUE β€” β€”
created_by UUID yes β€” FK users.id
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

rbac_permissions

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core/rbac_roles_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
name VARCHAR(255) no β€” UQ β€”
display_name VARCHAR(255) no β€” β€” β€”
description TEXT yes β€” β€” β€”
resource_type VARCHAR(255) no β€” β€” β€”
action VARCHAR(255) no β€” β€” β€”
category VARCHAR(255) no 'general' β€” β€”
is_system BOOLEAN no FALSE β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

rbac_role_permissions

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core/rbac_roles_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
role_id UUID no β€” FK rbac_roles.id
permission_id UUID no β€” FK rbac_permissions.id
granted_by UUID yes β€” FK users.id
granted_at TIMESTAMPTZ no NOW() β€” β€”

rbac_roles

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core/rbac_roles_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
name VARCHAR(255) no β€” UQ β€”
display_name VARCHAR(255) no β€” β€” β€”
description TEXT yes β€” β€” β€”
is_system BOOLEAN no FALSE β€” β€”
is_active BOOLEAN no TRUE β€” β€”
created_by UUID yes β€” FK users.id
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

rbac_user_groups

  • Domain: core Β· Feature gate: always available Β· Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/core/rbac_roles_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
user_id UUID no β€” FK users.id
group_id UUID no β€” FK rbac_groups.id
added_by UUID yes β€” FK users.id
added_at TIMESTAMPTZ no NOW() β€” β€”