Skip to content

Schema: compliance

Part of the generated database reference.

compliance_access_reviews

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
user_id UUID no โ€” โ€” โ€”
reviewer_id UUID no โ€” โ€” โ€”
review_date TIMESTAMPTZ no NOW() โ€” โ€”
permissions_reviewed JSONB no '[]' โ€” โ€”
anomalies JSONB no '[]' โ€” โ€”
recommendations JSONB no '[]' โ€” โ€”
status VARCHAR(255) no 'pending' โ€” โ€”
approved_at TIMESTAMPTZ yes โ€” โ€” โ€”
notes TEXT yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
updated_at TIMESTAMPTZ no NOW() โ€” โ€”
branch_id UUID yes โ€” FK branches.id

compliance_audit_log

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
event_type VARCHAR(255) no โ€” โ€” โ€”
user_id UUID yes โ€” โ€” โ€”
resource_type VARCHAR(255) no โ€” โ€” โ€”
resource_id VARCHAR(255) no โ€” โ€” โ€”
action VARCHAR(255) no โ€” โ€” โ€”
result VARCHAR(255) no 'success' โ€” โ€”
ip_address VARCHAR(255) yes โ€” โ€” โ€”
user_agent TEXT yes โ€” โ€” โ€”
metadata JSONB no '{}' โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
branch_id UUID yes โ€” FK branches.id

compliance_checks

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.36-schema-reconcile
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
branch_id UUID yes โ€” FK branches.id
status VARCHAR(255) no 'pending' โ€” โ€”
checked_at timestamptz yes โ€” โ€” โ€”
checked_by uuid yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
updated_at TIMESTAMPTZ no NOW() โ€” โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
check_type varchar no โ€” โ€” โ€”
target_type varchar yes โ€” โ€” โ€”
target_id UUID yes โ€” โ€” โ€”
result JSONB yes '{}'::jsonb โ€” โ€”

Drift: not found in migrations: check_type, checked_at, checked_by, target_type; in migrations only: control_id, control_name, evidence, framework, notes, score

compliance_control_evidence

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.72-compliance-frameworks
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
branch_id UUID no โ€” โ€” โ€”
control_id UUID no โ€” FK compliance_controls.id
file_path VARCHAR(500) no โ€” โ€” โ€”
description TEXT yes โ€” โ€” โ€”
evidence_type VARCHAR(50) no 'artifact' โ€” โ€”
status VARCHAR(20) no 'draft' โ€” โ€”
owner_id UUID yes โ€” โ€” โ€”
approved_by UUID yes โ€” โ€” โ€”
approved_at TIMESTAMPTZ yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
updated_at TIMESTAMPTZ no NOW() โ€” โ€”

Indexes: idx_compliance_evidence_branch(branch_id), idx_compliance_evidence_control(control_id)

compliance_controls

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.72-compliance-frameworks
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
branch_id UUID no โ€” โ€” โ€”
framework_id UUID no โ€” FK compliance_frameworks.id
control_id VARCHAR(100) no โ€” โ€” โ€”
title VARCHAR(500) no โ€” โ€” โ€”
description TEXT yes โ€” โ€” โ€”
category VARCHAR(100) yes โ€” โ€” โ€”
is_mandatory BOOLEAN no TRUE โ€” โ€”
version VARCHAR(50) no '1.0.0' โ€” โ€”
status VARCHAR(20) no 'active' โ€” โ€”
created_by UUID yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
updated_at TIMESTAMPTZ no NOW() โ€” โ€”

Indexes: idx_compliance_controls_branch(branch_id), idx_compliance_controls_framework(framework_id)

compliance_evidence

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
check_id uuid yes โ€” โ€” โ€”
issue_id UUID yes โ€” FK compliance_issues.id
evidence_type VARCHAR(255) no โ€” โ€” โ€”
title VARCHAR(255) no โ€” โ€” โ€”
description TEXT yes โ€” โ€” โ€”
file_url TEXT yes โ€” โ€” โ€”
file_name VARCHAR(255) yes โ€” โ€” โ€”
file_size INTEGER yes โ€” โ€” โ€”
mime_type VARCHAR(255) yes โ€” โ€” โ€”
metadata JSONB no '{}' โ€” โ€”
collected_at TIMESTAMPTZ no NOW() โ€” โ€”
collected_by UUID yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
branch_id UUID yes โ€” FK branches.id

Drift: not found in migrations: check_id

compliance_frameworks

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.72-compliance-frameworks
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
branch_id UUID no โ€” โ€” โ€”
name VARCHAR(255) no โ€” โ€” โ€”
version VARCHAR(50) no '1.0.0' โ€” โ€”
description TEXT yes โ€” โ€” โ€”
framework_key VARCHAR(50) no โ€” โ€” โ€”
status VARCHAR(20) no 'active' โ€” โ€”
created_by UUID yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
updated_at TIMESTAMPTZ no NOW() โ€” โ€”

Indexes: idx_compliance_frameworks_name_version(branch_id, name, version)

compliance_issues

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
check_id uuid yes โ€” FK compliance_checks.id
severity VARCHAR(255) no 'medium' โ€” โ€”
title VARCHAR(255) no โ€” โ€” โ€”
description TEXT no โ€” โ€” โ€”
remediation TEXT yes โ€” โ€” โ€”
due_date TIMESTAMPTZ yes โ€” โ€” โ€”
assigned_to UUID yes โ€” โ€” โ€”
status VARCHAR(255) no 'open' โ€” โ€”
resolved_at TIMESTAMPTZ yes โ€” โ€” โ€”
resolved_by UUID yes โ€” โ€” โ€”
resolution_notes TEXT yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
updated_at TIMESTAMPTZ no NOW() โ€” โ€”
branch_id UUID yes โ€” FK branches.id

compliance_risk_assessments

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
title VARCHAR(255) no โ€” โ€” โ€”
assessor_id UUID no โ€” โ€” โ€”
methodology VARCHAR(255) no 'qualitative' โ€” โ€”
overall_risk_score NUMERIC no 0 โ€” โ€”
status VARCHAR(255) no 'draft' โ€” โ€”
started_at TIMESTAMPTZ no NOW() โ€” โ€”
completed_at TIMESTAMPTZ yes โ€” โ€” โ€”
next_review_date VARCHAR(255) yes โ€” โ€” โ€”
notes TEXT yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
updated_at TIMESTAMPTZ no NOW() โ€” โ€”
branch_id UUID yes โ€” FK branches.id

compliance_risks

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
assessment_id UUID no โ€” FK compliance_risk_assessments.id
title VARCHAR(255) no โ€” โ€” โ€”
description TEXT yes โ€” โ€” โ€”
category VARCHAR(255) no 'operational' โ€” โ€”
likelihood_score INTEGER no 1 โ€” โ€”
impact_score INTEGER no 1 โ€” โ€”
risk_score INTEGER no 1 โ€” โ€”
risk_level VARCHAR(255) no 'low' โ€” โ€”
current_controls JSONB no '[]' โ€” โ€”
treatment_strategy VARCHAR(255) no 'mitigate' โ€” โ€”
status VARCHAR(255) no 'open' โ€” โ€”
owner_id UUID yes โ€” โ€” โ€”
due_date VARCHAR(255) yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
updated_at TIMESTAMPTZ no NOW() โ€” โ€”

compliance_training_records

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
user_id UUID no โ€” โ€” โ€”
training_type VARCHAR(255) no โ€” โ€” โ€”
training_name VARCHAR(255) no โ€” โ€” โ€”
provider VARCHAR(255) yes โ€” โ€” โ€”
score INTEGER yes โ€” โ€” โ€”
passed BOOLEAN no FALSE โ€” โ€”
completion_date TIMESTAMPTZ no NOW() โ€” โ€”
valid_until TIMESTAMPTZ yes โ€” โ€” โ€”
certificate_url TEXT yes โ€” โ€” โ€”
metadata JSONB no '{}' โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
branch_id UUID yes โ€” FK branches.id
  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
consent_id UUID no โ€” FK cookie_consents.id
action VARCHAR(255) no โ€” โ€” โ€”
previous_consents JSONB no '{}' โ€” โ€”
new_consents JSONB no '{}' โ€” โ€”
ip_address VARCHAR(255) yes โ€” โ€” โ€”
user_agent TEXT yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
user_id UUID yes โ€” โ€” โ€”
session_id VARCHAR(255) yes โ€” โ€” โ€”
ip_address VARCHAR(255) yes โ€” โ€” โ€”
user_agent TEXT yes โ€” โ€” โ€”
country_code VARCHAR(255) yes โ€” โ€” โ€”
consent_necessary BOOLEAN no TRUE โ€” โ€”
consent_analytics BOOLEAN no FALSE โ€” โ€”
consent_marketing BOOLEAN no FALSE โ€” โ€”
consent_preferences BOOLEAN no FALSE โ€” โ€”
consent_functional BOOLEAN no FALSE โ€” โ€”
consent_version VARCHAR(255) no โ€” โ€” โ€”
consent_given_at TIMESTAMPTZ no NOW() โ€” โ€”
consent_updated_at TIMESTAMPTZ no NOW() โ€” โ€”
consent_withdrawn_at TIMESTAMPTZ yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
branch_id UUID yes โ€” FK branches.id

data_deletion_requests

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
user_id UUID no โ€” โ€” โ€”
request_type VARCHAR(255) no 'full' โ€” โ€”
status VARCHAR(255) no 'pending' โ€” โ€”
reason TEXT yes โ€” โ€” โ€”
requested_at TIMESTAMPTZ no NOW() โ€” โ€”
scheduled_for TIMESTAMPTZ yes โ€” โ€” โ€”
completed_at TIMESTAMPTZ yes โ€” โ€” โ€”
confirmation_token VARCHAR(255) no โ€” โ€” โ€”
confirmed_at TIMESTAMPTZ yes โ€” โ€” โ€”
processed_by UUID yes โ€” โ€” โ€”
notes TEXT yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
updated_at TIMESTAMPTZ no NOW() โ€” โ€”
branch_id UUID yes โ€” FK branches.id

data_export_requests

  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
user_id UUID no โ€” โ€” โ€”
status VARCHAR(255) no 'pending' โ€” โ€”
format VARCHAR(255) no 'json' โ€” โ€”
include_sections JSONB no '["all"]' โ€” โ€”
requested_at TIMESTAMPTZ no NOW() โ€” โ€”
started_at TIMESTAMPTZ yes โ€” โ€” โ€”
completed_at TIMESTAMPTZ yes โ€” โ€” โ€”
file_url TEXT yes โ€” โ€” โ€”
file_size INTEGER yes โ€” โ€” โ€”
expires_at TIMESTAMPTZ yes โ€” โ€” โ€”
error_message TEXT yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”
branch_id UUID yes โ€” FK branches.id
  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
org_id UUID no โ€” FK organizations.org_id
bot_id UUID no โ€” โ€” โ€”
user_id UUID no โ€” โ€” โ€”
document_id UUID no โ€” FK legal_documents.id
document_version VARCHAR(255) no โ€” โ€” โ€”
accepted_at TIMESTAMPTZ no NOW() โ€” โ€”
ip_address VARCHAR(255) yes โ€” โ€” โ€”
user_agent TEXT yes โ€” โ€” โ€”
branch_id UUID yes โ€” FK branches.id
  • Domain: compliance ยท Feature gate: #[cfg(feature = "compliance")] ยท Migration: 6.5.15.1-consolidated
  • Rust source: botschema/src/compliance.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK โ€”
document_id UUID no โ€” FK legal_documents.id
version VARCHAR(255) no โ€” โ€” โ€”
content TEXT no โ€” โ€” โ€”
change_summary TEXT yes โ€” โ€” โ€”
created_by UUID yes โ€” โ€” โ€”
created_at TIMESTAMPTZ no NOW() โ€” โ€”