Skip to content

Schema: people (part 2)

Part of the generated database reference.

hr_clock_entries

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.09-hr-timeclock
  • Rust source: botschema/src/people/people_skills_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
bot_id UUID no β€” β€” β€”
person_id UUID no β€” β€” β€”
entry_type VARCHAR(20) no β€” β€” β€”
timestamp TIMESTAMPTZ no NOW() β€” β€”
latitude NUMERIC(10,7) yes β€” β€” β€”
longitude NUMERIC(10,7) yes β€” β€” β€”
geofence_id UUID yes β€” β€” β€”
device_id VARCHAR(100) yes β€” β€” β€”
ip_address VARCHAR(64) yes β€” β€” β€”
notes TEXT yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

hr_holidays

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.09-hr-timeclock
  • Rust source: botschema/src/people/people_skills_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
bot_id UUID no β€” β€” β€”
name VARCHAR(100) no β€” β€” β€”
holiday_date DATE no β€” β€” β€”
is_recurring BOOLEAN no false β€” β€”
region VARCHAR(50) yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

hr_overtime_rules

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.09-hr-timeclock
  • Rust source: botschema/src/people/people_skills_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
bot_id UUID no β€” β€” β€”
name VARCHAR(100) no β€” β€” β€”
weekly_threshold_hours NUMERIC(5,2) no 44.0 β€” β€”
daily_threshold_hours NUMERIC(5,2) yes β€” β€” β€”
overtime_multiplier NUMERIC(4,2) no 1.5 β€” β€”
night_shift_multiplier NUMERIC(4,2) no 1.2 β€” β€”
holiday_multiplier NUMERIC(4,2) no 2.0 β€” β€”
is_active BOOLEAN no true β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

hr_schedules

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.09-hr-timeclock
  • Rust source: botschema/src/people/people_skills_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
bot_id UUID no β€” β€” β€”
person_id UUID no β€” β€” β€”
weekday INTEGER no β€” β€” β€”
start_time TIME no β€” β€” β€”
end_time TIME no β€” β€” β€”
break_minutes INTEGER no 60 β€” β€”
effective_from DATE no β€” β€” β€”
effective_until DATE yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

hr_work_periods

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.09-hr-timeclock
  • Rust source: botschema/src/people/people_skills_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
bot_id UUID no β€” β€” β€”
person_id UUID no β€” β€” β€”
period_start DATE no β€” β€” β€”
period_end DATE no β€” β€” β€”
hours_worked NUMERIC(8,2) no 0 β€” β€”
hours_overtime NUMERIC(8,2) no 0 β€” β€”
hours_night NUMERIC(8,2) no 0 β€” β€”
absences INTEGER no 0 β€” β€”
status VARCHAR(30) no 'open' β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

ip_reputation

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.7.12-missing-feature-tables
  • Rust source: botschema/src/people/marketing_campaign_events_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
org_id UUID no β€” β€” β€”
ip VARCHAR(64) no β€” β€” β€”
provider VARCHAR(100) no β€” β€” β€”
delivered BIGINT no 0 β€” β€”
bounced BIGINT no 0 β€” β€”
complained BIGINT no 0 β€” β€”
window_start TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ yes β€” β€” β€”

ip_rotations

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.7.12-missing-feature-tables
  • Rust source: botschema/src/people/marketing_campaign_events_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
org_id UUID no β€” β€” β€”
ip_address VARCHAR(64) no β€” β€” β€”
strategy VARCHAR(50) yes β€” β€” β€”
current_index INTEGER yes β€” β€” β€”
last_used TIMESTAMPTZ yes β€” β€” β€”
is_active BOOLEAN yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

Indexes: idx_ip_rotations_org(org_id, is_active)

marketing_campaign_events

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.47-campaign-worker
  • Rust source: botschema/src/people/marketing_campaign_events_tables.rs
Column SQL type Null Default Key References
id uuid no gen_random_uuid() PK β€”
branch_id uuid no '00000000-0000-0000-0000-000000000000' β€” β€”
campaign_id uuid no β€” FK marketing_campaigns.id
channel varchar(20) yes β€” β€” β€”
event_type varchar(20) no β€” β€” β€”
recipient_email varchar(255) yes β€” β€” β€”
status varchar(20) yes β€” β€” β€”
error_message text yes β€” β€” β€”
created_at timestamptz no now() β€” β€”

marketing_campaigns

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.47-campaign-worker
  • Rust source: botschema/src/people/people_skills_tables.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 β€” β€” β€”
name VARCHAR(255) no β€” β€” β€”
status VARCHAR(255) no 'draft' β€” β€”
campaign_type varchar no β€” β€” β€”
content_template JSONB no '{}' β€” β€”
starts_at timestamptz yes β€” β€” β€”
sent_at TIMESTAMPTZ yes β€” β€” β€”
ends_at timestamptz yes β€” β€” β€”
metrics JSONB no '{}' β€” β€”
budget DOUBLE PRECISION yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ yes NOW() β€” β€”
deal_id UUID yes β€” FK crm_deals.id
branch_id uuid yes β€” FK branches.id
run_offset INTEGER yes 0 β€” β€”
pause_requested BOOLEAN yes false β€” β€”
stop_requested BOOLEAN yes false β€” β€”
started_at timestamptz yes β€” β€” β€”
completed_at timestamptz yes β€” β€” β€”

Drift: not found in migrations: campaign_type, ends_at, starts_at; in migrations only: channel, scheduled_at

marketing_contacts

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.50-marketing-contacts
  • Rust source: botschema/src/people/marketing_campaign_events_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
branch_id UUID no β€” FK branches.id
list_id UUID yes β€” FK marketing_lists.id
email VARCHAR no β€” β€” β€”
name VARCHAR yes β€” β€” β€”
phone VARCHAR yes β€” β€” β€”
metadata JSONB yes β€” β€” β€”
subscribed BOOLEAN yes true β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

marketing_email_opens

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.7.12-missing-feature-tables
  • Rust source: botschema/src/people/marketing_campaign_events_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
branch_id UUID no β€” β€” β€”
campaign_id UUID yes β€” β€” β€”
email VARCHAR(255) no β€” β€” β€”
opened_at TIMESTAMPTZ no NOW() β€” β€”
ip_address VARCHAR(64) yes β€” β€” β€”
user_agent TEXT yes β€” β€” β€”

Indexes: idx_marketing_email_opens_email(email, opened_at)

marketing_list_contacts

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.51-isolated-marketing-lists
  • Rust source: botschema/src/people/people_skills_tables.rs
Column SQL type Null Default Key References
list_id UUID no β€” PK, FK marketing_lists.id
contact_id UUID no β€” PK, FK crm_contacts.id
added_at TIMESTAMPTZ no now() β€” β€”

marketing_lists

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.36-schema-reconcile
  • Rust source: botschema/src/people/people_skills_tables.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 β€” β€” β€”
name VARCHAR(255) no β€” β€” β€”
list_type VARCHAR(255) no β€” β€” β€”
query_text TEXT yes β€” β€” β€”
contact_count INTEGER yes 0 β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ yes NOW() β€” β€”
branch_id UUID yes β€” FK branches.id
description TEXT yes β€” β€” β€”
member_count INTEGER yes 0 β€” β€”
is_dynamic BOOLEAN yes FALSE β€” β€”
criteria JSONB yes '{}'::jsonb β€” β€”

marketing_recipients

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.48-marketing-recipients-reconcile
  • Rust source: botschema/src/people/people_skills_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
campaign_id UUID yes β€” FK marketing_campaigns.id
contact_id UUID yes β€” FK crm_contacts.id
deal_id UUID yes β€” FK crm_deals.id
channel VARCHAR(255) no β€” β€” β€”
status VARCHAR(255) no 'pending' β€” β€”
sent_at TIMESTAMPTZ yes β€” β€” β€”
delivered_at TIMESTAMPTZ yes β€” β€” β€”
failed_at TIMESTAMPTZ yes β€” β€” β€”
error_message TEXT yes β€” β€” β€”
response JSONB yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
branch_id uuid no '00000000-0000-0000-0000-000000000000' β€” β€”
list_id uuid yes β€” β€” β€”
email varchar(255) yes β€” β€” β€”
name varchar(255) yes β€” β€” β€”
opened_at timestamptz yes β€” β€” β€”
clicked_at timestamptz yes β€” β€” β€”

marketing_suppressions

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.9.2-marketing-suppressions
  • Rust source: botschema/src/people/people_skills_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
branch_id UUID no β€” β€” β€”
email TEXT no β€” β€” β€”
channel TEXT no β€” β€” β€”
reason TEXT no 'unsubscribed' β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”

Indexes: marketing_suppressions_branch_channel_email_idx(branch_id, channel, email), marketing_suppressions_branch_email_idx(branch_id, email)

marketing_templates

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/people/people_skills_tables.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 β€” β€” β€”
name VARCHAR(255) no β€” β€” β€”
channel VARCHAR(255) no β€” β€” β€”
subject VARCHAR(255) yes β€” β€” β€”
body TEXT yes β€” β€” β€”
media_url VARCHAR(255) yes β€” β€” β€”
ai_prompt TEXT yes β€” β€” β€”
variables JSONB no '[]' β€” β€”
approved BOOLEAN yes false β€” β€”
meta_template_id VARCHAR(255) yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ yes NOW() β€” β€”
branch_id UUID yes β€” FK branches.id

org_ips

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.7.12-missing-feature-tables
  • Rust source: botschema/src/people/marketing_campaign_events_tables.rs
Column SQL type Null Default Key References
id UUID no gen_random_uuid() PK β€”
org_id UUID no β€” β€” β€”
ip_address VARCHAR(64) no β€” β€” β€”
provider VARCHAR(100) yes β€” β€” β€”
is_active BOOLEAN yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

Indexes: idx_org_ips_org(org_id, is_active)

people

  • Domain: people Β· Feature gate: #[cfg(feature = "people")] Β· Migration: 6.5.23-branch-scope-cleanup
  • Rust source: botschema/src/people.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 β€” β€” β€”
branch_id UUID yes β€” FK branches.id
user_id UUID yes β€” β€” β€”
first_name VARCHAR(255) no β€” β€” β€”
last_name VARCHAR(255) yes β€” β€” β€”
email VARCHAR(255) yes β€” β€” β€”
phone VARCHAR(255) yes β€” β€” β€”
mobile VARCHAR(255) yes β€” β€” β€”
job_title VARCHAR(255) yes β€” β€” β€”
department VARCHAR(255) yes β€” β€” β€”
manager_id UUID yes β€” FK people.id
office_location VARCHAR(255) yes β€” β€” β€”
hire_date VARCHAR(255) yes β€” β€” β€”
birthday VARCHAR(255) yes β€” β€” β€”
avatar_url TEXT yes β€” β€” β€”
bio TEXT yes β€” β€” β€”
skills TEXT[] no '{}' β€” β€”
social_links JSONB no '{}' β€” β€”
custom_fields JSONB no '{}' β€” β€”
timezone VARCHAR(255) yes β€” β€” β€”
locale VARCHAR(255) yes β€” β€” β€”
is_active BOOLEAN no TRUE β€” β€”
last_seen_at TIMESTAMPTZ yes β€” β€” β€”
created_at TIMESTAMPTZ no NOW() β€” β€”
updated_at TIMESTAMPTZ no NOW() β€” β€”

Indexes: idx_unified_search_people(to_tsvector('english', COALESCE(first_name::text, '')