Schema: core (part 2)
Part of the generated database reference.
rbac_user_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 |
β |
| user_id |
UUID |
no |
β |
FK |
users.id |
| role_id |
UUID |
no |
β |
FK |
rbac_roles.id |
| granted_by |
UUID |
yes |
β |
FK |
users.id |
| granted_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| expires_at |
TIMESTAMPTZ |
yes |
β |
β |
β |
- 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 |
TEXT |
no |
β |
PK |
β |
| session_id |
TEXT |
no |
β |
β |
β |
| tool_name |
TEXT |
no |
β |
β |
β |
| added_at |
TEXT |
no |
β |
β |
β |
system_automations
System automations with TriggerKind: 0=Scheduled, 1=TableUpdate, 2=TableInsert, 3=TableDelete, 4=Webhook, 5=EmailReceived, 6=FolderChange
- 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 |
| kind |
INTEGER |
no |
β |
β |
β |
| target |
TEXT |
yes |
β |
β |
β |
| schedule |
TEXT |
yes |
β |
β |
β |
| param |
TEXT |
no |
β |
β |
β |
| is_active |
BOOLEAN |
no |
TRUE |
β |
β |
| last_triggered |
TIMESTAMPTZ |
yes |
β |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
| created_at |
timestamptz |
no |
now() |
β |
β |
| name |
VARCHAR(255) |
yes |
β |
β |
β |
Indexes: idx_system_automations_active(kind), idx_system_automations_bot_id(bot_id), idx_system_automations_bot_kind_param(bot_id, kind, param)
tasks
- Domain:
core Β· Feature gate: always available Β· Migration: 6.7.11-tasks-parent-id
- Rust source:
botschema/src/core/rbac_roles_tables.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| title |
TEXT |
no |
β |
β |
β |
| description |
TEXT |
yes |
β |
β |
β |
| status |
TEXT |
no |
'todo' |
β |
β |
| priority |
TEXT |
no |
'medium' |
β |
β |
| assignee_id |
UUID |
yes |
β |
FK |
users.id |
| reporter_id |
UUID |
yes |
β |
FK |
users.id |
| project_id |
UUID |
yes |
β |
β |
β |
| due_date |
TIMESTAMPTZ |
yes |
β |
β |
β |
| tags |
TEXT[] |
no |
'{}' |
β |
β |
| dependencies |
UUID[] |
no |
'{}' |
β |
β |
| estimated_hours |
DOUBLE PRECISION |
yes |
β |
β |
β |
| actual_hours |
DOUBLE PRECISION |
yes |
β |
β |
β |
| progress |
INTEGER |
no |
0 |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| completed_at |
TIMESTAMPTZ |
yes |
β |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
| stage |
TEXT |
no |
'plan' |
β |
β |
| parent_id |
UUID |
yes |
β |
FK |
tasks.id |
tenants
- 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 |
β |
| name |
TEXT |
no |
β |
UQ |
β |
| slug |
TEXT |
no |
β |
UQ |
β |
| is_active |
BOOLEAN |
no |
true |
β |
β |
| metadata |
JSONB |
yes |
'{}'::jsonb |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
user_llm_accounts
- Domain:
core Β· Feature gate: always available Β· Migration: 6.8.4-user-llm-accounts
- Rust source:
botschema/src/core/user_llm_accounts.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| user_id |
UUID |
no |
β |
FK |
users.id |
| provider |
TEXT |
no |
β |
β |
β |
| status |
TEXT |
no |
'unlinked' |
β |
β |
| vm_name |
TEXT |
yes |
β |
β |
β |
| account_email |
TEXT |
yes |
β |
β |
β |
| plan |
TEXT |
yes |
β |
β |
β |
| vault_path |
TEXT |
yes |
β |
β |
β |
| host_id |
TEXT |
yes |
β |
β |
β |
| client_id |
TEXT |
yes |
β |
β |
β |
| scopes |
TEXT |
yes |
β |
β |
β |
| linked_at |
TIMESTAMPTZ |
yes |
β |
β |
β |
| last_verified_at |
TIMESTAMPTZ |
yes |
β |
β |
β |
| metadata |
JSONB |
no |
'{}'::jsonb |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
Indexes: idx_user_llm_accounts_provider(provider, status), uq_user_llm_accounts_user_provider(user_id, provider)
user_login_tokens
- 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 |
| token_hash |
VARCHAR(255) |
no |
β |
β |
β |
| expires_at |
TIMESTAMPTZ |
no |
β |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| last_used |
TIMESTAMPTZ |
no |
now() |
β |
β |
| user_agent |
TEXT |
yes |
β |
β |
β |
| ip_address |
VARCHAR(255) |
yes |
β |
β |
β |
| is_active |
BOOLEAN |
no |
TRUE |
β |
β |
Indexes: idx_user_login_tokens_expires(expires_at), idx_user_login_tokens_user_id(user_id)
user_organizations
User membership in organizations with 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 |
β |
| user_id |
UUID |
no |
β |
FK |
users.id |
| org_id |
UUID |
no |
β |
FK |
organizations.org_id |
| role |
VARCHAR(255) |
no |
'member' |
β |
β |
| is_default |
BOOLEAN |
no |
false |
β |
β |
| joined_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
user_preferences
- 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 |
| preference_key |
VARCHAR(255) |
no |
β |
β |
β |
| preference_value |
JSONB |
no |
β |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
Indexes: idx_user_preferences_user_id(user_id)
user_sessions
- Domain:
core Β· Feature gate: always available Β· Migration: 6.8.7-chat-lock
- Rust source:
botschema/src/core.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| user_id |
UUID |
no |
β |
FK |
users.id |
| bot_id |
UUID |
no |
β |
FK |
bots.id |
| title |
TEXT |
no |
'New Conversation'::character varying |
β |
β |
| answer_mode |
int4 |
no |
0 |
β |
β |
| context_data |
JSONB |
no |
'{}'::jsonb |
β |
β |
| current_tool |
TEXT |
yes |
β |
β |
β |
| message_count |
int4 |
no |
0 |
β |
β |
| total_tokens |
int4 |
no |
0 |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| last_activity |
timestamptz |
no |
now() |
β |
β |
| tenant_id |
UUID |
yes |
β |
β |
β |
| active_email_account_id |
uuid |
yes |
β |
FK |
user_email_accounts.id |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
| session_id |
VARCHAR |
yes |
β |
β |
β |
| data |
JSONB |
yes |
β |
β |
β |
| expires_at |
TIMESTAMPTZ |
yes |
β |
β |
β |
| locked |
BOOLEAN |
no |
FALSE |
β |
β |
| lock_pin_hash |
TEXT |
yes |
β |
β |
β |
Indexes: idx_user_sessions_updated_at(updated_at), idx_user_sessions_user_bot(user_id, bot_id)
users
- Domain:
core Β· Feature gate: always available Β· Migration: 6.7.10-users-is-admin
- Rust source:
botschema/src/core.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| username |
TEXT |
no |
β |
β |
β |
| email |
TEXT |
no |
β |
β |
β |
| password_hash |
TEXT |
no |
β |
β |
β |
| phone_number |
varchar(50) |
yes |
β |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| is_active |
BOOLEAN |
no |
TRUE |
β |
β |
| is_admin |
BOOLEAN |
no |
FALSE |
β |
β |
website_crawls
- Domain:
core Β· Feature gate: always available Β· Migration: 6.5.23-branch-scope-cleanup
- 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 |
| url |
TEXT |
no |
β |
β |
β |
| last_crawled |
TIMESTAMPTZ |
yes |
β |
β |
β |
| next_crawl |
TIMESTAMPTZ |
yes |
β |
β |
β |
| expires_policy |
VARCHAR(255) |
no |
'1d' |
β |
β |
| max_depth |
INTEGER |
yes |
3 |
β |
β |
| max_pages |
INTEGER |
yes |
100 |
β |
β |
| crawl_status |
SMALLINT |
yes |
0 |
β |
β |
| pages_crawled |
INTEGER |
yes |
0 |
β |
β |
| error_message |
TEXT |
yes |
β |
β |
β |
| created_at |
TIMESTAMPTZ |
yes |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
yes |
NOW() |
β |
β |
| refresh_policy |
VARCHAR(255) |
yes |
β |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
workflow_events
- Domain:
core Β· Feature gate: always available Β· Migration: 6.7.9-workflow-events-correlation-id
- Rust source:
botschema/src/core.rs
| Column |
SQL type |
Null |
Default |
Key |
References |
| id |
UUID |
no |
gen_random_uuid() |
PK |
β |
| workflow_id |
UUID |
no |
β |
FK |
workflow_executions.id |
| event_name |
TEXT |
no |
β |
β |
β |
| event_data_json |
JSONB |
yes |
β |
β |
β |
| processed |
BOOLEAN |
no |
FALSE |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
Drift: in migrations only: event_type, execution_id, payload
workflow_executions
- 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 |
| workflow_name |
TEXT |
no |
β |
β |
β |
| current_step |
INTEGER |
no |
1 |
β |
β |
| state_json |
JSONB |
no |
β |
β |
β |
| status |
TEXT |
no |
'running' |
β |
β |
| created_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| updated_at |
TIMESTAMPTZ |
no |
NOW() |
β |
β |
| branch_id |
UUID |
yes |
β |
FK |
branches.id |
Drift: in migrations only: completed_at, error, initiated_by, input_data, metadata, output_data, session_id, started_at, step_results, workflow_id