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