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() โ€” โ€”