Database Schema
Every table, column, index, and constraint from SQL migrations
190 migrations | 157 tables | 447 indexes
Migrations
| # | File | Tables |
|---|---|---|
| 001 | 001_create_core_tables.sql | user_workspace_access, client_registry, client_settings, client_pricing, client_costs, monthly_revenue_snapshots, client_zipcodes |
| 002 | 002_create_contact_pipeline.sql | raw_contacts, verified_contacts, weekly_batches, upload_audit_log, debounce_usage |
| 003 | 003_create_scraping_jobs.sql | scraping_jobs, scraping_job_logs, agent_runs, agent_errors, site_credentials |
| 004 | 004_create_lead_management.sql | client_leads |
| 005 | 005_create_email_infrastructure.sql | email_accounts, email_account_metadata, email_account_polling |
| 006 | 006_create_user_profiles.sql | user_profiles |
| 006 | 006_optimize_raw_contacts.sql | (alter/index only) |
| 007 | 007_fix_raw_contacts_schema.sql | (alter/index only) |
| 008 | 008_create_filter_rules.sql | client_filter_rules |
| 009 | 009_add_missing_verified_fields.sql | (alter/index only) |
| 010 | 010_create_default_filter_rules.sql | (alter/index only) |
| 011 | 011_add_email_bison_workspace_mapping.sql | (alter/index only) |
| 012 | 012_add_bison_campaign_id.sql | (alter/index only) |
| 013 | 013_create_vault_functions.sql | (alter/index only) |
| 014 | 014_update_site_credentials_schema.sql | (alter/index only) |
| 015 | 015_create_credential_audit_log.sql | credential_audit_log |
| 016 | 016_create_scraping_job_batches.sql | scraping_job_batches |
| 017 | 017_create_campaign_metrics.sql | campaign_metrics |
| 018 | 018_add_duplicate_detection_indexes.sql | (alter/index only) |
| 018 | 018_create_debounce_bulk_jobs.sql | debounce_bulk_jobs |
| 019 | 019_add_credential_to_jobs.sql | (alter/index only) |
| 020 | 020_create_task_progress_tables.sql | filtering_tasks, verification_tasks |
| 021 | 021_add_workspace_contact_fields.sql | (alter/index only) |
| 022 | 022_tighten_rls_policies.sql | (alter/index only) |
| 023 | 023_create_pipeline_runs.sql | pipeline_runs |
| 024 | 024_add_month_filter_to_stats.sql | (alter/index only) |
| 025 | 025_add_upload_status_to_verified_contacts.sql | (alter/index only) |
| 026 | 026_update_pipeline_stats_with_upload_status.sql | (alter/index only) |
| 027 | 027_email_bison_account_sync.sql | (alter/index only) |
| 028 | 028_campaign_metrics_progress.sql | (alter/index only) |
| 029 | 029_client_leads_bison_sync.sql | (alter/index only) |
| 030 | 030_client_targets.sql | client_targets |
| 031 | 031_crm_webhook_integration.sql | crm_delivery_log, slack_notifications_sent, lead_replies, webhook_delivery_log, webhook_health |
| 032 | 032_master_contacts_integration.sql | home_value_codes |
| 033 | 033_campaign_crm_routing.sql | campaign_crm_routing |
| 034 | 034_add_csv_processing_status.sql | (alter/index only) |
| 035 | 035_add_month_leading_indexes.sql | (alter/index only) |
| 035 | 035_create_tasks_table.sql | tasks |
| 035 | 035_reply_response_tracking.sql | (alter/index only) |
| 036 | 036_auto_reply_config.sql | auto_reply_config, auto_reply_log |
| 037 | 037_thomas_migration_compat.sql | reply_templates, sent_replies, sma_policies, client_metrics, monthly_daily_revenue_history |
| 038 | 038_add_bounce_alert_throttle.sql | (alter/index only) |
| 038 | 038_daily_revenue_unique_index.sql | (alter/index only) |
| 039 | 039_extra_data_and_bison_field_mapping.sql | (alter/index only) |
| 039 | 039_unique_workspace_lead_email.sql | (alter/index only) |
| 040 | 040_add_source_type_to_contact_stats.sql | (alter/index only) |
| 041 | 041_backfill_source_type_scraped.sql | (alter/index only) |
| 041 | 041_bison_source_of_truth.sql | (alter/index only) |
| 042 | 042_pipeline_stats_all_months.sql | (alter/index only) |
| 042 | 042_workspace_stats_cache.sql | workspace_stats_cache |
| 043 | 043_analyze_and_index_for_performance.sql | (alter/index only) |
| 044 | 044_pipeline_stats_cache_table.sql | pipeline_stats_cache |
| 045 | 045_workspace_daily_stats.sql | workspace_daily_stats |
| 046 | 046_backfill_client_type.sql | (alter/index only) |
| 047 | 047_mx_checked_at.sql | (alter/index only) |
| 048 | 048_infrastructure_orders.sql | reseller_configs, infrastructure_orders, infrastructure_order_events |
| 049 | 049_normalize_pipeline_stages.sql | (alter/index only) |
| 050 | 050_sma_policies_rls.sql | (alter/index only) |
| 051 | 051_workspace_access_rls_helper.sql | (alter/index only) |
| 052 | 052_onboarding_drafts.sql | onboarding_drafts |
| 053 | 053_agent_conversations.sql | agent_threads, agent_messages |
| 054 | 054_infrastructure_action_items_rpc.sql | (alter/index only) |
| 055 | 055_fix_warmup_disabled_count.sql | (alter/index only) |
| 056 | 056_fix_action_items_jsonb_cast.sql | (alter/index only) |
| 057 | 057_fix_reseller_warmup_periods.sql | (alter/index only) |
| 058 | 058_domain_tracking.sql | (alter/index only) |
| 059 | 059_task_events.sql | task_events |
| 060 | 060_hall_of_fame.sql | hall_of_fame_nominations, hall_of_fame_votes |
| 060 | 060_tasks_v2.sql | task_activity |
| 062 | 062_increment_daily_interested.sql | (alter/index only) |
| 063 | 063_normalize_contact_names_trigger.sql | (alter/index only) |
| 064 | 064_reply_ai_upgrade.sql | ai_generation_log, prompt_eval_results |
| 064 | 064_week_bucket_not_null.sql | (alter/index only) |
| 065 | 065_crm_destinations.sql | crm_destinations |
| 065 | 065_reply_templates_unique_workspace.sql | (alter/index only) |
| 066 | 066_crm_routing_flag.sql | (alter/index only) |
| 067 | 067_burnt_domains_root_domain_grouping.sql | (alter/index only) |
| 068 | 068_dedup_aggregation_functions.sql | (alter/index only) |
| 069 | 069_client_registry_excluded_zips.sql | (alter/index only) |
| 070 | 070_zip_inclusion_mode.sql | (alter/index only) |
| 071 | 071_raw_contacts_bypass_routing.sql | (alter/index only) |
| 072 | 072_resources.sql | resources, resource_requests |
| 073 | 073_revenue_adjustments.sql | revenue_refunds, revenue_referrals |
| 073 | 073_task_timeline.sql | task_timeline |
| 074 | 074_client_registry_slack_webhook_commercial.sql | (alter/index only) |
| 074 | 074_task_timeline_more_events.sql | (alter/index only) |
| 075 | 075_user_profiles_slack_user_id.sql | (alter/index only) |
| 076 | 076_slack_event_dedup.sql | slack_event_dedup |
| 076 | 076_verified_contacts_provider.sql | (alter/index only) |
| 077 | 077_account_counter_safety.sql | (alter/index only) |
| 078 | 078_dedup_campaign_metrics.sql | (alter/index only) |
| 079 | 079_audit_phase_a_config_tables.sql | audit_verticals, audit_recommendation_rules, audit_sync_state |
| 080 | 080_audit_phase_a_rank_tables.sql | audit_rank_by_subject, audit_rank_by_pitch, audit_rank_by_parent_template, audit_rank_by_master_template, audit_rank_by_step, audit_rank_by_sender_combo, audit_rank_by_sender_domain, audit_rank_by_sender_local_pattern |
| 081 | 081_audit_phase_a_action_tables.sql | audit_recommendations, audit_deployments, audit_outcomes |
| 081 | 081_xpressdocs_bulk_backfill.sql | xpressdocs_backfill_jobs |
| 082 | 082_audit_phase_a_replies_origins.sql | audit_replies, audit_origins |
| 083 | 083_audit_phase_a_step_stats.sql | audit_step_stats |
| 083 | 083_lead_replies_sender_email.sql | (alter/index only) |
| 084 | 084_audit_phase_a_senders.sql | audit_senders |
| 084 | 084_email_account_daily_stats.sql | email_account_daily_stats |
| 085 | 085_audit_phase_a_origin_outcome.sql | (alter/index only) |
| 086 | 086_audit_phase_a_briefings.sql | audit_briefings |
| 087 | 087_workspace_volume_tracking.sql | workspace_volume_tracking |
| 088 | 088_drop_volume_tracking_check.sql | (alter/index only) |
| 089 | 089_audit_client_category.sql | (alter/index only) |
| 090 | 090_billing_audit.sql | billing_subscriptions, billing_receipts, billing_disputes |
| 091 | 091_billing_reconciliation_columns.sql | (alter/index only) |
| 092 | 092_vendor_id_dedup_per_month.sql | (alter/index only) |
| 093 | 093_client_registry_slack_webhook_url_commercial.sql | (alter/index only) |
| 094 | 094_audit_step_stats_current.sql | (alter/index only) |
| 095 | 095_audit_rank_by_pitch_sample_subject.sql | (alter/index only) |
| 095 | 095_qualifying_question_conversion.sql | (alter/index only) |
| 096 | 096_audit_commercial_recommendation_rules.sql | (alter/index only) |
| 097 | 097_audit_stage_runs.sql | audit_stage_runs |
| 098 | 098_client_registry_exclude_from_dashboard.sql | (alter/index only) |
| 099 | 099_scraped_renewal_backfill_rpc.sql | (alter/index only) |
| 100 | 100_scraped_renewal_rpc_renewal_formatted.sql | (alter/index only) |
| 102 | 102_webhook_ingress_status.sql | (alter/index only) |
| 103 | 103_billing_first_interested_rpc.sql | (alter/index only) |
| 109 | 109_interested_format_promotions.sql | interested_format_promotions |
| 110 | 110_email_accounts_mx_checked_at.sql | (alter/index only) |
| 111 | 111_dob_backfill_rpc.sql | (alter/index only) |
| 112 | 112_infrastructure_summary_rpc.sql | (alter/index only) |
| 113 | 113_audit_workspace_pitches.sql | audit_workspace_pitches |
| 113 | 113_raw_contacts_source_type_datamoon.sql | (alter/index only) |
| 114 | 114_audit_audience_stats.sql | audit_audience_stats |
| 115 | 115_carrier_list_scrub.sql | carrier_scrub_runs, carrier_affiliations |
| 116 | 116_carrier_scrub_slack_channel.sql | (alter/index only) |
| 117 | 117_spam_block_events.sql | spam_block_events |
| 118 | 118_email_conversation_operating_intake_setup.sql | operating_source_accounts, operating_source_events, operating_threads, operating_thread_messages, operating_source_artifacts, operating_intake_runs |
| 118 | 118_slack_operating_intake_capture.sql | slack_conversations, slack_users, slack_events_raw, slack_messages, slack_ingest_runs |
| 119 | 119_client_operating_timeline.sql | operating_timeline_events, operating_timeline_event_links, operating_timeline_export_runs |
| 119 | 119_slack_operating_intake_phase_c_autonomy.sql | slack_channel_policies, slack_channel_coverage_events, operating_intake_items, brain_writeback_queue |
| 120 | 120_client_operating_timeline_view_security.sql | (alter/index only) |
| 120 | 120_infra_order_pipeline_v2.sql | client_onboardings, onboarding_steps |
| 121 | 121_client_onboardings_form_fields.sql | (alter/index only) |
| 121 | 121_email_verification_second_pass_queue.sql | email_verification_second_pass_queue |
| 121 | 121_operating_indexing_engine.sql | operating_entities, operating_entity_matches, operating_intake_classifications, operating_intake_review_items, operating_intake_writebacks, operating_digest_runs |
| 122 | 122_infra_orders_workspace_ingest.sql | (alter/index only) |
| 122 | 122_operating_knowledge_promotion.sql | operating_entity_aliases, operating_process_taxonomy, operating_timeline_events, operating_timeline_event_links, operating_promotion_runs, operating_brain_patch_candidates |
| 122 | 122_slack_operating_intake_phase_c_fk_indexes.sql | (alter/index only) |
| 123 | 123_client_onboardings_expected_domains.sql | (alter/index only) |
| 123 | 123_operating_timeline_event_link_replacement_rpc.sql | (alter/index only) |
| 124 | 124_operating_knowledge_promotion_index_cleanup.sql | (alter/index only) |
| 125 | 125_operating_timeline_source_first_shape.sql | (alter/index only) |
| 126 | 126_brain_patch_path_resolution.sql | (alter/index only) |
| 127 | 127_message_context_wiring.sql | (alter/index only) |
| 128 | 128_operating_backfill_controller.sql | operating_backfill_jobs, operating_backfill_items |
| 129 | 129_purge_cross_workspace_stat_pollution.sql | stat_pollution_backup_2026_07 |
| 130 | 130_purge_volume_tracking_gaudio_copies_0619.sql | (alter/index only) |
| 131 | 131_daily_audit_engine.sql | audit_rules, audit_findings |
| 132 | 132_client_status_onboarding.sql | (alter/index only) |
| 133 | 133_operating_timeline_summary_repair_backup.sql | operating_timeline_summary_repair_backup |
| 134 | 134_auto_forward_dropped_producers.sql | auto_forward_config, auto_forward_log |
| 135 | 135_expected_domains_per_provider.sql | (alter/index only) |
| 136 | 136_reseller_tags_per_provider.sql | (alter/index only) |
| 137 | 137_rename_limits_set_to_warmup_running.sql | (alter/index only) |
| 138 | 138_mailbox_counts_per_provider.sql | (alter/index only) |
| 139 | 139_chicago_bucket_time_series.sql | (alter/index only) |
| 140 | 140_infrastructure_orders_bison_campaign_id.sql | (alter/index only) |
| 141 | 141_orders_first_spine.sql | infra_reconciliation_runs |
| 143 | 143_workspace_diagnostics.sql | diagnostics_runs, workspace_diagnostics_findings, bison_campaign_snapshots |
| 144 | 144_purge_schrauf_phantom_campaign_stats.sql | (alter/index only) |
| 145 | 145_channel_client_attribution.sql | (alter/index only) |
| 145 | 145_purge_audit_phantom_rows_polluted_workspaces.sql | (alter/index only) |
| 146 | 146_email_accounts_order_link.sql | (alter/index only) |
| 147 | 147_internal_panels_reseller_configs.sql | (alter/index only) |
| 148 | 148_client_registry_google_chat_webhook.sql | (alter/index only) |
| 148 | 148_daily_sending_target_audit.sql | (alter/index only) |
| 149 | 149_diagnostics_runs_skipped.sql | (alter/index only) |
| 150 | 150_audience_rebuild_per_workspace.sql | (alter/index only) |
| 151 | 151_client_announcements.sql | client_announcements, announcement_deliveries, announcement_reads, announcement_email_optouts, announcement_extra_recipients |
| 151 | 151_order_send_activity.sql | order_send_activity |
| 152 | 152_announcements_webhook_column.sql | (alter/index only) |
| 152 | 152_order_send_activity_limit_tracking.sql | (alter/index only) |
| 153 | 153_drop_announcement_extra_recipients.sql | (alter/index only) |
| 153 | 153_infra_workspace_daily.sql | infra_workspace_daily |
| 153 | 153_sensor_repair.sql | (alter/index only) |
| 154 | 154_announcement_event_engine.sql | announcement_event_policies |
| 154 | 154_disconnect_state.sql | sender_disconnect_state |
| 155 | 155_announcement_pipeline_enrollment.sql | announcement_pipeline_enrollment |
| 155 | 155_ramp_executor_rule.sql | (alter/index only) |
| 156 | 156_account_deletion_queue.sql | account_deletion_queue |
| 157 | 157_reseller_values_confirmed.sql | (alter/index only) |
| 158 | 158_burnt_cohorts.sql | burnt_cohorts |
| 159 | 159_send_failure_spike.sql | (alter/index only) |
| 160 | 160_summary_freshness.sql | (alter/index only) |
| 161 | 161_burnt_domains_warmup_score_gate.sql | (alter/index only) |
| 161 | 161_spam_block_events_dsn_body.sql | (alter/index only) |
| 162 | 162_resources_workspace_targeting.sql | (alter/index only) |
Tables
user_workspace_access
Multi-tenant user access control - maps users to workspaces with roles
Defined in: 001_create_core_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
user_id | UUID | NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE |
workspace_name | TEXT | NOT NULL |
role | TEXT | NOT NULL CHECK (role IN ('admin', 'client', 'viewer')) |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
client_registry
Master client registry - single source of truth for all client data
Defined in: 001_create_core_tables.sql
| Column | Type | Constraints |
|---|---|---|
workspace_id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL UNIQUE |
display_name | TEXT | |
is_active | BOOLEAN | DEFAULT true |
billing_type | TEXT | CHECK (billing_type IN ('per_lead', 'retainer')) |
price_per_lead | DECIMAL(10,2) | DEFAULT 0.00 |
retainer_amount | DECIMAL(10,2) | DEFAULT 0.00 |
monthly_kpi_target | INTEGER | DEFAULT 0 |
monthly_contact_target | INTEGER | DEFAULT 0 |
contact_tier | TEXT | CHECK (contact_tier IN ('100_leads', '200_leads', 'custom')) |
daily_sending_target | INTEGER | DEFAULT 0 |
bison_workspace_id | INTEGER | |
bison_api_key | TEXT | |
bison_instance | TEXT | |
agency_color | TEXT | |
airtable_record_id | TEXT | |
client_type | TEXT | DEFAULT 'home_insurance' |
slack_webhook_url | TEXT | |
notes | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
client_settings
Defined in: 001_create_core_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | UNIQUE REFERENCES public.client_registry(workspace_name) ON DELETE CASCADE |
settings | JSONB | DEFAULT '{}'::jsonb |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
client_pricing
Defined in: 001_create_core_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | UNIQUE REFERENCES public.client_registry(workspace_name) ON DELETE CASCADE |
billing_type | TEXT | CHECK (billing_type IN ('per_lead', 'retainer')) |
price_per_lead | DECIMAL(10,2) | DEFAULT 0.00 |
retainer_amount | DECIMAL(10,2) | DEFAULT 0.00 |
effective_date | DATE | DEFAULT CURRENT_DATE |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
client_costs
Defined in: 001_create_core_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | REFERENCES public.client_registry(workspace_name) ON DELETE CASCADE |
month | TEXT | NOT NULL |
email_account_costs | DECIMAL(10,2) | DEFAULT 0.00 |
labor_costs | DECIMAL(10,2) | DEFAULT 0.00 |
other_costs | DECIMAL(10,2) | DEFAULT 0.00 |
total_costs | DECIMAL(10,2) | GENERATED ALWAYS AS (email_account_costs + labor_costs + other_costs) STORED |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
monthly_revenue_snapshots
Defined in: 001_create_core_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | REFERENCES public.client_registry(workspace_name) ON DELETE CASCADE |
month | TEXT | NOT NULL |
billable_leads | INTEGER | DEFAULT 0 |
per_lead_revenue | DECIMAL(10,2) | DEFAULT 0.00 |
retainer_revenue | DECIMAL(10,2) | DEFAULT 0.00 |
total_revenue | DECIMAL(10,2) | GENERATED ALWAYS AS (per_lead_revenue + retainer_revenue) STORED |
snapshot_date | DATE | DEFAULT CURRENT_DATE |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
client_zipcodes
ZIP code assignments by client and month
Defined in: 001_create_core_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | REFERENCES public.client_registry(workspace_name) ON DELETE CASCADE |
zip_code | TEXT | NOT NULL |
state | TEXT | NOT NULL |
month | TEXT | NOT NULL, -- "2025-11" or "active" for staging |
assigned_at | TIMESTAMPTZ | DEFAULT NOW() |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
raw_contacts
Raw contact uploads from Xpressdocs/Cole X Dates before processing
Defined in: 002_create_contact_pipeline.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
upload_batch_id | UUID | NOT NULL DEFAULT gen_random_uuid() |
workspace_name | TEXT | REFERENCES public.client_registry(workspace_name) |
month | TEXT | NOT NULL |
uploaded_by | TEXT | |
uploaded_at | TIMESTAMPTZ | DEFAULT NOW() |
scraping_job_id | UUID | |
zip_code | TEXT | |
state | TEXT | |
first_name | TEXT | |
last_name | TEXT | |
email | TEXT | NOT NULL |
phone | TEXT | |
mailing_address | TEXT | |
mailing_city | TEXT | |
mailing_state | TEXT | |
mailing_zip | TEXT | |
property_address | TEXT | |
property_city | TEXT | |
property_state | TEXT | |
property_zip | TEXT | |
home_value_estimate | DECIMAL(12,2) | |
purchase_date | DATE | |
processing_status | TEXT | DEFAULT 'pending' CHECK (processing_status IN ('pending', 'filtered_out', 'ready_for_verification', 'verified', 'failed')) |
is_head_of_household | BOOLEAN | DEFAULT false |
meets_value_criteria | BOOLEAN | DEFAULT false |
is_high_net_worth | BOOLEAN | DEFAULT false |
parsed_purchase_date | DATE | |
filter_reason | TEXT | |
processed_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
verified_contacts
Email-verified contacts ready for weekly batch uploads
Defined in: 002_create_contact_pipeline.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
raw_contact_id | BIGINT | REFERENCES public.raw_contacts(id) ON DELETE CASCADE |
workspace_name | TEXT | NOT NULL REFERENCES public.client_registry(workspace_name) |
month | TEXT | NOT NULL |
first_name | TEXT | |
last_name | TEXT | |
email | TEXT | NOT NULL |
property_address | TEXT | |
property_city | TEXT | |
property_state | TEXT | |
property_zip | TEXT | |
home_value_estimate | DECIMAL(12,2) | |
purchase_date | DATE | |
purchase_day | INTEGER | |
renewal_start_date | DATE | |
renewal_end_date | DATE | |
week_bucket | INTEGER | CHECK (week_bucket BETWEEN 1 AND 4) |
debounce_status | TEXT | CHECK (debounce_status IN ('deliverable', 'undeliverable', 'risky', 'unknown', 'pending')) |
debounce_response | JSONB | |
debounce_verified_at | TIMESTAMPTZ | |
debounce_credits_used | INTEGER | DEFAULT 1 |
is_high_net_worth | BOOLEAN | DEFAULT false |
target_campaign | TEXT | |
is_uploaded | BOOLEAN | DEFAULT false |
upload_batch_id | UUID | |
uploaded_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
weekly_batches
Tracks each weekly batch upload to Email Bison (every Monday)
Defined in: 002_create_contact_pipeline.sql
| Column | Type | Constraints |
|---|---|---|
batch_id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL REFERENCES public.client_registry(workspace_name) |
month | TEXT | NOT NULL |
week_number | INTEGER | NOT NULL CHECK (week_number BETWEEN 1 AND 4) |
week_bucket | INTEGER | NOT NULL CHECK (week_bucket BETWEEN 1 AND 4) |
scheduled_upload_date | DATE | NOT NULL |
actual_upload_date | DATE | |
contact_count | INTEGER | DEFAULT 0 |
hnw_count | INTEGER | DEFAULT 0 |
csv_file_path | TEXT | |
csv_generated_at | TIMESTAMPTZ | |
bison_upload_id | TEXT | |
bison_campaign_name | TEXT | |
bison_upload_status | TEXT | DEFAULT 'pending' CHECK (bison_upload_status IN ('pending', 'uploaded', 'added_to_campaign', 'failed')) |
bison_error_message | TEXT | |
slack_notification_sent | BOOLEAN | DEFAULT false |
slack_message_ts | TEXT | |
slack_approved_by | TEXT | |
slack_approved_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
upload_audit_log
Complete audit trail of all automated pipeline operations
Defined in: 002_create_contact_pipeline.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
batch_id | UUID | REFERENCES public.weekly_batches(batch_id) ON DELETE CASCADE |
workspace_name | TEXT | NOT NULL |
month | TEXT | NOT NULL |
action | TEXT | NOT NULL CHECK (action IN ('csv_upload', 'contact_verification', 'batch_generation', 'bison_upload', 'campaign_add', 'campaign_rename', 'slack_notification')) |
status | TEXT | NOT NULL CHECK (status IN ('success', 'partial_success', 'failed')) |
contacts_processed | INTEGER | DEFAULT 0 |
contacts_succeeded | INTEGER | DEFAULT 0 |
contacts_failed | INTEGER | DEFAULT 0 |
api_endpoint | TEXT | |
api_request | JSONB | |
api_response | JSONB | |
error_details | JSONB | |
duration_ms | INTEGER | |
credits_used | INTEGER | |
performed_by | TEXT | DEFAULT 'system' |
performed_at | TIMESTAMPTZ | DEFAULT NOW() |
debounce_usage
Tracks Debounce API credit usage for billing and monitoring
Defined in: 002_create_contact_pipeline.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
month | TEXT | NOT NULL |
workspace_name | TEXT | |
batch_id | UUID | REFERENCES public.weekly_batches(batch_id) |
credits_used | INTEGER | NOT NULL DEFAULT 0 |
emails_verified | INTEGER | NOT NULL DEFAULT 0 |
deliverable_count | INTEGER | DEFAULT 0 |
undeliverable_count | INTEGER | DEFAULT 0 |
risky_count | INTEGER | DEFAULT 0 |
unknown_count | INTEGER | DEFAULT 0 |
verified_at | TIMESTAMPTZ | DEFAULT NOW() |
scraping_jobs
Tracks Xpressdocs scraping jobs with status and results
Defined in: 003_create_scraping_jobs.sql
| Column | Type | Constraints |
|---|---|---|
job_id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | REFERENCES public.client_registry(workspace_name) |
job_type | TEXT | DEFAULT 'xpressdocs_scrape' |
state | TEXT | NOT NULL |
zip_codes | TEXT[] | NOT NULL |
month | TEXT | NOT NULL |
list_type | TEXT | DEFAULT 'Emailing' |
status | TEXT | DEFAULT 'pending' CHECK (status IN ('pending', 'running', 'completed', 'failed', 'limit_exceeded', 'cancelled')) |
progress | INTEGER | DEFAULT 0 |
total_zips | INTEGER | |
processed_zips | INTEGER | DEFAULT 0 |
records_downloaded | INTEGER | DEFAULT 0 |
csv_files | TEXT[] | |
error_message | TEXT | |
celery_task_id | TEXT | |
started_at | TIMESTAMPTZ | |
completed_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
scraping_job_logs
Detailed logs for each step of a scraping job
Defined in: 003_create_scraping_jobs.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
job_id | UUID | REFERENCES public.scraping_jobs(job_id) ON DELETE CASCADE |
step | TEXT | NOT NULL |
status | TEXT | NOT NULL |
message | TEXT | |
zip_codes | TEXT[] | |
records_count | INTEGER | |
logged_at | TIMESTAMPTZ | DEFAULT NOW() |
agent_runs
Tracks all automation workflow executions
Defined in: 003_create_scraping_jobs.sql
| Column | Type | Constraints |
|---|---|---|
run_id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workflow | TEXT | NOT NULL |
client_id | INTEGER | REFERENCES public.client_registry(workspace_id) |
site | TEXT | |
status | TEXT | DEFAULT 'running' CHECK (status IN ('running', 'success', 'failed', 'partial')) |
started_at | TIMESTAMPTZ | DEFAULT NOW() |
finished_at | TIMESTAMPTZ | |
metrics | JSONB | |
trace_url | TEXT | |
error | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
agent_errors
Detailed error tracking with screenshots and traces
Defined in: 003_create_scraping_jobs.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
run_id | UUID | REFERENCES public.agent_runs(run_id) ON DELETE CASCADE |
step | TEXT | NOT NULL |
error_type | TEXT | NOT NULL |
message | TEXT | NOT NULL |
stack_trace | TEXT | |
screenshot_url | TEXT | |
trace_url | TEXT | |
context | JSONB | |
retry_count | INTEGER | DEFAULT 0 |
resolved | BOOLEAN | DEFAULT false |
resolved_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
site_credentials
Secure credential storage for external sites
Defined in: 003_create_scraping_jobs.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
site | TEXT | NOT NULL |
username | TEXT | NOT NULL |
secret_ref | TEXT | NOT NULL |
state_coverage | TEXT[] | |
mfa_type | TEXT | |
last_verified_at | TIMESTAMPTZ | |
notes | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
client_leads
Client portal leads with pipeline management
Defined in: 004_create_lead_management.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | |
first_name | TEXT | |
last_name | TEXT | |
phone | TEXT | |
address | TEXT | |
city | TEXT | |
state | TEXT | |
zip | TEXT | |
date_received | TIMESTAMPTZ | |
reply_received | TEXT | |
email_sent | TEXT | |
email_subject | TEXT | |
lead_value | DECIMAL(10,2) | DEFAULT 500.00 |
renewal_date | TEXT | |
birthday | TEXT | |
campaign_name | TEXT | |
sender_email | TEXT | |
icp | BOOLEAN | DEFAULT false |
pipeline_stage | TEXT | DEFAULT 'new' |
pipeline_position | INTEGER | DEFAULT 0 |
interested | BOOLEAN | DEFAULT false |
notes | TEXT | |
premium_amount | DECIMAL(10,2) | |
policy_type | TEXT | |
bison_conversation_url | TEXT | |
bison_lead_id | TEXT | |
reply_uuid | TEXT | |
custom_variables | JSONB | |
tags | TEXT[] | |
airtable_id | TEXT | UNIQUE |
deleted_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
last_synced_at | TIMESTAMPTZ | DEFAULT NOW() |
email_accounts
Email account inventory with health and capacity tracking
Defined in: 005_create_email_infrastructure.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
email_address | TEXT | UNIQUE NOT NULL |
workspace_name | TEXT | REFERENCES public.client_registry(workspace_name) |
status | TEXT | DEFAULT 'active' |
health_score | INTEGER | DEFAULT 100 |
daily_sending_limit | INTEGER | DEFAULT 50 |
volume_per_account | INTEGER | DEFAULT 0 |
provider | TEXT | |
notes | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
email_account_metadata
Daily performance metrics for email accounts
Defined in: 005_create_email_infrastructure.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
email_account_id | INTEGER | REFERENCES public.email_accounts(id) ON DELETE CASCADE |
sent_count | INTEGER | DEFAULT 0 |
delivered_count | INTEGER | DEFAULT 0 |
bounce_rate | DECIMAL(5,2) | |
spam_rate | DECIMAL(5,2) | |
metric_date | DATE | NOT NULL |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
email_account_polling
Tracks email account polling job status
Defined in: 005_create_email_infrastructure.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
last_poll_at | TIMESTAMPTZ | |
next_poll_at | TIMESTAMPTZ | |
status | TEXT | DEFAULT 'idle' |
error_message | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
user_profiles
Extended user profile information linked to auth.users
Defined in: 006_create_user_profiles.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY REFERENCES auth.users(id) ON DELETE CASCADE |
email | TEXT | NOT NULL UNIQUE |
full_name | TEXT | |
avatar_url | TEXT | |
phone | TEXT | |
default_workspace_name | TEXT | REFERENCES public.client_registry(workspace_name) ON DELETE SET NULL |
is_active | BOOLEAN | DEFAULT true |
email_verified | BOOLEAN | DEFAULT false |
last_login_at | TIMESTAMPTZ | |
login_count | INTEGER | DEFAULT 0 |
metadata | JSONB | DEFAULT '{}'::jsonb |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
client_filter_rules
Client-specific filter rules applied before email verification
Defined in: 008_create_filter_rules.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL REFERENCES public.client_registry(workspace_name) ON DELETE CASCADE |
rule_name | TEXT | NOT NULL |
priority | INTEGER | NOT NULL DEFAULT 100, -- Lower number = higher priority |
is_active | BOOLEAN | DEFAULT true |
field_name | TEXT | NOT NULL, -- Column name in raw_contacts |
operator | TEXT | NOT NULL CHECK (operator IN ( |
value | JSONB | NOT NULL, -- Expected value (can be string, number, array) |
action | TEXT | NOT NULL CHECK (action IN ('require', 'reject')), -- What to do if rule matches |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
credential_audit_log
Audit trail for all credential management actions
Defined in: 015_create_credential_audit_log.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
credential_id | INTEGER | REFERENCES public.site_credentials(id) ON DELETE SET NULL |
action | TEXT | NOT NULL CHECK (action IN ('created', 'updated', 'deleted', 'tested', 'password_changed', 'accessed')) |
performed_by | UUID | REFERENCES auth.users(id) ON DELETE SET NULL |
ip_address | TEXT | |
user_agent | TEXT | |
details | JSONB | DEFAULT '{}'::jsonb |
previous_state | JSONB | |
new_state | JSONB | |
success | BOOLEAN | DEFAULT true |
error_message | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
scraping_job_batches
Child table for scraping_jobs. Each batch represents one state being scraped in parallel. Enables 3-5x speedup via concurrent worker execution.
Defined in: 016_create_scraping_job_batches.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
job_id | UUID | NOT NULL REFERENCES public.scraping_jobs(job_id) ON DELETE CASCADE |
batch_number | INT | NOT NULL |
state | TEXT | NOT NULL |
zip_codes | TEXT[] | NOT NULL |
month | TEXT | NOT NULL |
list_type | TEXT | NOT NULL |
workspace_name | TEXT | NOT NULL |
credential_id | INT | REFERENCES public.site_credentials(id) |
status | TEXT | NOT NULL DEFAULT 'pending' |
celery_task_id | TEXT | UNIQUE |
csv_file_path | TEXT | |
record_count | INT | DEFAULT 0 |
split_count | INT | DEFAULT 0, -- Number of times batch was split due to 10K limit |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
started_at | TIMESTAMPTZ | |
completed_at | TIMESTAMPTZ | |
duration_seconds | INT | |
retry_count | INT | DEFAULT 0 |
max_retries | INT | DEFAULT 3 |
error_message | TEXT | |
error_type | TEXT, | -- 'browser_crash', 'timeout', 'auth_failure', 'network_error' |
browser_profile | TEXT, | -- Chromium profile used |
ip_address | TEXT, | -- For debugging geolocation issues |
campaign_metrics
Stores performance metrics synced from Email Bison campaigns
Defined in: 017_create_campaign_metrics.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
batch_id | UUID | REFERENCES public.weekly_batches(batch_id) ON DELETE CASCADE |
email_bison_campaign_id | TEXT | NOT NULL |
emails_sent | INT | DEFAULT 0 |
emails_delivered | INT | DEFAULT 0 |
emails_bounced | INT | DEFAULT 0 |
emails_opened | INT | DEFAULT 0 |
emails_clicked | INT | DEFAULT 0 |
emails_replied | INT | DEFAULT 0 |
unsubscribed | INT | DEFAULT 0 |
open_rate | FLOAT | DEFAULT 0.0 |
click_rate | FLOAT | DEFAULT 0.0 |
reply_rate | FLOAT | DEFAULT 0.0 |
synced_at | TIMESTAMPTZ | DEFAULT NOW() |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
debounce_bulk_jobs
Tracks bulk email verification jobs submitted to Debounce Bulk API. Enables 10-100x faster verification compared to sequential API calls. Auto-used when batch_size > 50 emails.
Defined in: 018_create_debounce_bulk_jobs.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
job_id | UUID | UNIQUE DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL REFERENCES public.client_registry(workspace_name) |
month | TEXT | NOT NULL |
debounce_list_id | TEXT | UNIQUE, -- From Debounce API response |
debounce_list_name | TEXT | |
upload_csv_url | TEXT | NOT NULL, -- Public URL we sent to Debounce |
result_csv_url | TEXT, | -- CDN URL from Debounce |
storage_path | TEXT, | -- Our storage path for cleanup |
status | TEXT | NOT NULL DEFAULT 'uploading' |
percentage | INT | DEFAULT 0, -- Processing progress (0-100) |
total_emails | INT | NOT NULL |
processed_emails | INT | DEFAULT 0 |
deliverable_count | INT | DEFAULT 0 |
undeliverable_count | INT | DEFAULT 0 |
risky_count | INT | DEFAULT 0 |
unknown_count | INT | DEFAULT 0 |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
submitted_at | TIMESTAMPTZ, | -- When sent to Debounce |
completed_at | TIMESTAMPTZ | |
downloaded_at | TIMESTAMPTZ, | -- When results downloaded |
error_message | TEXT | |
retry_count | INT | DEFAULT 0 |
max_retries | INT | DEFAULT 3 |
credits_used | INT |
filtering_tasks
Tracks filtering task progress for real-time SSE updates to frontend
Defined in: 020_create_task_progress_tables.sql
| Column | Type | Constraints |
|---|---|---|
task_id | TEXT | PRIMARY KEY |
workspace_name | TEXT | NOT NULL REFERENCES public.client_registry(workspace_name) |
status | TEXT | NOT NULL DEFAULT 'pending' |
total | INTEGER | NOT NULL DEFAULT 0 |
processed | INTEGER | NOT NULL DEFAULT 0 |
passed | INTEGER | NOT NULL DEFAULT 0 |
filtered_out | INTEGER | NOT NULL DEFAULT 0 |
source_status | TEXT | NOT NULL DEFAULT 'pending' |
batch_size | INTEGER | NOT NULL DEFAULT 1000 |
error | TEXT | |
started_at | TIMESTAMPTZ | |
completed_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
verification_tasks
Tracks verification task progress for real-time SSE updates to frontend
Defined in: 020_create_task_progress_tables.sql
| Column | Type | Constraints |
|---|---|---|
task_id | TEXT | PRIMARY KEY |
workspace_name | TEXT | NOT NULL REFERENCES public.client_registry(workspace_name) |
status | TEXT | NOT NULL DEFAULT 'pending' |
method | TEXT | NOT NULL DEFAULT 'sequential' |
total | INTEGER | NOT NULL DEFAULT 0 |
processed | INTEGER | NOT NULL DEFAULT 0 |
verified | INTEGER | NOT NULL DEFAULT 0 |
invalid | INTEGER | NOT NULL DEFAULT 0 |
unknown | INTEGER | NOT NULL DEFAULT 0 |
bulk_job_id | TEXT | |
debounce_status | TEXT | |
batch_size | INTEGER | NOT NULL DEFAULT 100 |
error | TEXT | |
started_at | TIMESTAMPTZ | |
completed_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
pipeline_runs
Tracks complete pipeline executions from sourcing to Email Bison upload
Defined in: 023_create_pipeline_runs.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
run_id | UUID | DEFAULT gen_random_uuid() UNIQUE NOT NULL |
workspace_name | TEXT | NOT NULL REFERENCES client_registry(workspace_name) |
month | TEXT | NOT NULL, -- YYYY-MM format |
source | TEXT | NOT NULL DEFAULT 'scraper', -- 'scraper', 'master_db', 'csv_upload' |
target_volume | INTEGER | |
state | TEXT | |
zip_codes | TEXT[], | -- Array of ZIP codes |
status | TEXT | NOT NULL DEFAULT 'pending', -- pending, running, completed, failed, cancelled |
current_stage | TEXT | DEFAULT 'init', -- init, scraping, processing, filtering, verifying, batching, uploading, completed |
stage_counts | JSONB | DEFAULT '{}'::jsonb |
started_at | TIMESTAMPTZ | |
completed_at | TIMESTAMPTZ | |
error_message | TEXT | |
error_stage | TEXT | |
celery_task_ids | JSONB | DEFAULT '{}'::jsonb |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
created_by | UUID | REFERENCES auth.users(id) |
client_targets
Monthly KPI targets and progress tracking for Gap-to-Goal dashboard
Defined in: 030_client_targets.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL REFERENCES public.client_registry(workspace_name) |
month | TEXT | NOT NULL, -- YYYY-MM format |
contact_volume_target | INTEGER | DEFAULT 0 |
email_volume_target | INTEGER | DEFAULT 0 |
lead_target | INTEGER | DEFAULT 0 |
revenue_target | NUMERIC(10,2) | DEFAULT 0 |
contacts_uploaded | INTEGER | DEFAULT 0 |
emails_sent | INTEGER | DEFAULT 0 |
leads_generated | INTEGER | DEFAULT 0 |
revenue_actual | NUMERIC(10,2) | DEFAULT 0 |
contacts_gap | INTEGER | GENERATED ALWAYS AS (contact_volume_target - contacts_uploaded) STORED |
emails_gap | INTEGER | GENERATED ALWAYS AS (email_volume_target - emails_sent) STORED |
leads_gap | INTEGER | GENERATED ALWAYS AS (lead_target - leads_generated) STORED |
revenue_gap | NUMERIC(10,2) | GENERATED ALWAYS AS (revenue_target - revenue_actual) STORED |
contacts_progress | NUMERIC(5,2) | GENERATED ALWAYS AS ( |
CASE | WHEN | contact_volume_target > 0 |
ELSE | 0 | END |
emails_progress | NUMERIC(5,2) | GENERATED ALWAYS AS ( |
CASE | WHEN | email_volume_target > 0 |
ELSE | 0 | END |
leads_progress | NUMERIC(5,2) | GENERATED ALWAYS AS ( |
CASE | WHEN | lead_target > 0 |
ELSE | 0 | END |
revenue_progress | NUMERIC(5,2) | GENERATED ALWAYS AS ( |
CASE | WHEN | revenue_target > 0 |
THEN | LEAST(ROUND((revenue_actual | / revenue_target * 100), 2), 999.99) |
ELSE | 0 | END |
targets_overridden | BOOLEAN | DEFAULT false |
notes | TEXT | |
last_synced_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
crm_delivery_log
Tracks all lead deliveries to external CRMs (Agency Zoom, Ricochet, etc.)
Defined in: 031_crm_webhook_integration.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | NOT NULL |
bison_lead_id | TEXT | |
bison_reply_id | TEXT | |
crm_type | TEXT | NOT NULL, -- 'agency_zoom', 'ricochet', 'ezlynx', 'agency_mvp', 'generic' |
crm_endpoint | TEXT | NOT NULL |
success | BOOLEAN | NOT NULL DEFAULT FALSE |
http_status_code | INTEGER | |
response_body | TEXT | |
error_message | TEXT | |
attempt_number | INTEGER | NOT NULL DEFAULT 1 |
max_attempts | INTEGER | NOT NULL DEFAULT 3 |
next_retry_at | TIMESTAMPTZ | |
request_payload | JSONB | |
request_headers | JSONB | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
completed_at | TIMESTAMPTZ |
slack_notifications_sent
Deduplication table for Slack notifications
Defined in: 031_crm_webhook_integration.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
reply_id | TEXT | NOT NULL |
workspace_name | TEXT | NOT NULL |
notification_type | TEXT | NOT NULL, -- 'client', 'global' |
lead_email | TEXT | |
slack_webhook_url | TEXT | |
sent_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
lead_replies
Stores all Email Bison replies for live dashboard and CRM routing
Defined in: 031_crm_webhook_integration.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | NOT NULL |
first_name | TEXT | |
last_name | TEXT | |
company | TEXT | |
title | TEXT | |
phone | TEXT | |
reply_text | TEXT | |
reply_date | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
sentiment | TEXT | CHECK (sentiment IN ('positive', 'negative', 'neutral')) |
is_interested | BOOLEAN | DEFAULT FALSE |
confidence_score | INTEGER | |
ai_reasoning | TEXT | |
sentiment_source | TEXT | CHECK (sentiment_source IN ('ai', 'bison', 'hybrid', 'manual')) |
bison_sentiment | TEXT | |
needs_review | BOOLEAN | DEFAULT FALSE |
bison_lead_id | TEXT | |
bison_reply_id | TEXT | UNIQUE |
bison_reply_numeric_id | INTEGER | |
bison_conversation_url | TEXT | |
bison_workspace_id | TEXT | |
live_replies_enabled | BOOLEAN | DEFAULT TRUE |
crm_sent_at | TIMESTAMPTZ | |
crm_delivery_status | TEXT | CHECK (crm_delivery_status IN ('pending', 'sent', 'failed', 'retrying')) |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
webhook_delivery_log
Logs all incoming Email Bison webhooks for debugging
Defined in: 031_crm_webhook_integration.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
event_type | TEXT | NOT NULL |
workspace_name | TEXT | |
payload | JSONB | NOT NULL |
success | BOOLEAN | NOT NULL DEFAULT FALSE |
processing_time_ms | INTEGER | |
error_message | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
webhook_health
Per-workspace webhook health metrics
Defined in: 031_crm_webhook_integration.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL UNIQUE |
last_webhook_at | TIMESTAMPTZ | |
webhook_count_24h | INTEGER | DEFAULT 0 |
success_rate_24h | NUMERIC(5,2) | DEFAULT 100.00 |
is_healthy | BOOLEAN | DEFAULT TRUE |
last_error_message | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
home_value_codes
Lookup table for home value codes (A-U) to dollar amounts
Defined in: 032_master_contacts_integration.sql
| Column | Type | Constraints |
|---|---|---|
code | TEXT | PRIMARY KEY |
min_value | INTEGER | |
max_value | INTEGER | |
midpoint | INTEGER | NOT NULL |
description | TEXT |
campaign_crm_routing
Campaign-level CRM routing overrides for workspace defaults
Defined in: 033_campaign_crm_routing.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
campaign_id | INT | NOT NULL UNIQUE |
campaign_name | TEXT, | -- For reference/display |
workspace_name | TEXT | NOT NULL |
crm_type | TEXT, | -- 'zapier', 'agency_zoom', 'agency_mvp', etc. |
external_api_url | TEXT | NOT NULL, -- The webhook URL |
external_api_token | TEXT, | -- If authentication needed |
is_active | BOOLEAN | DEFAULT true |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
tasks
Defined in: 035_create_tasks_table.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
title | TEXT | NOT NULL |
description | TEXT | |
assignee_id | UUID | REFERENCES public.user_profiles(id) ON DELETE SET NULL |
assignee_name | TEXT, | -- Denormalized for fast display |
created_by | UUID | NOT NULL REFERENCES public.user_profiles(id) |
status | TEXT | NOT NULL DEFAULT 'todo' |
priority | TEXT | NOT NULL DEFAULT 'medium' |
category | TEXT | NOT NULL DEFAULT 'operations' |
visibility | TEXT | NOT NULL DEFAULT 'team' |
due_date | DATE | |
completed_at | TIMESTAMPTZ | |
source | JSONB | DEFAULT '{}'::jsonb |
is_recurring | BOOLEAN | DEFAULT false |
recurring_pattern | TEXT | |
last_completed | TIMESTAMPTZ | |
last_reminded_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
auto_reply_config
Defined in: 036_auto_reply_config.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL UNIQUE |
enabled | BOOLEAN | NOT NULL DEFAULT false |
tone | TEXT | NOT NULL DEFAULT 'professional' |
min_confidence_score | INT | NOT NULL DEFAULT 70 |
reply_to_interested | BOOLEAN | NOT NULL DEFAULT true |
reply_to_not_interested | BOOLEAN | NOT NULL DEFAULT false |
reply_to_neutral | BOOLEAN | NOT NULL DEFAULT false |
skip_auto_replies | BOOLEAN | NOT NULL DEFAULT true |
skip_bounced | BOOLEAN | NOT NULL DEFAULT true |
max_replies_per_hour | INT | NOT NULL DEFAULT 20 |
delay_seconds | INT | NOT NULL DEFAULT 300 |
custom_instructions | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT now() |
updated_at | TIMESTAMPTZ | DEFAULT now() |
auto_reply_log
Defined in: 036_auto_reply_config.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_reply_id | UUID | REFERENCES lead_replies(id) |
bison_reply_numeric_id | INT | |
lead_email | TEXT | |
sentiment | TEXT | |
confidence_score | INT | |
tone_used | TEXT | |
reply_text | TEXT | |
model_used | TEXT | |
sent_successfully | BOOLEAN | NOT NULL DEFAULT false |
skipped_reason | TEXT | |
error_message | TEXT | |
processing_time_ms | INT | |
created_at | TIMESTAMPTZ | DEFAULT now() |
reply_templates
Defined in: 037_thomas_migration_compat.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
template_text_with_phone | TEXT | |
template_text_no_phone | TEXT | |
cc_emails | JSONB | DEFAULT '[]' |
special_instructions | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT now() |
updated_at | TIMESTAMPTZ | DEFAULT now() |
sent_replies
Defined in: 037_thomas_migration_compat.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
bison_reply_id | INTEGER | |
reply_uuid | TEXT | |
lead_name | TEXT | |
lead_email | TEXT | |
generated_reply_text | TEXT | |
cc_emails | JSONB | DEFAULT '[]' |
sent_by | TEXT | |
sent_at | TIMESTAMPTZ | |
status | TEXT | DEFAULT 'sent' CHECK (status IN ('pending', 'sent', 'failed', 'draft')) |
error_message | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT now() |
sma_policies
Defined in: 037_thomas_migration_compat.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_id | UUID | |
policy_type | TEXT | |
premium_amount | DECIMAL(10,2) | |
agency_commission | DECIMAL(10,2) | |
maverick_commission | DECIMAL(10,2) | |
created_at | TIMESTAMPTZ | DEFAULT now() |
updated_at | TIMESTAMPTZ | DEFAULT now() |
client_metrics
Defined in: 037_thomas_migration_compat.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
metric_date | DATE | NOT NULL |
metric_type | TEXT | DEFAULT 'mtd' |
emails_sent | INTEGER | DEFAULT 0 |
emails_sent_today | INTEGER | DEFAULT 0 |
emails_sent_mtd | INTEGER | DEFAULT 0 |
emails_sent_last_7_days | INTEGER | DEFAULT 0 |
emails_sent_last_14_days | INTEGER | DEFAULT 0 |
emails_sent_last_30_days | INTEGER | DEFAULT 0 |
emails_scheduled_today | INTEGER | DEFAULT 0 |
emails_scheduled_tomorrow | INTEGER | DEFAULT 0 |
positive_replies | INTEGER | DEFAULT 0 |
positive_replies_mtd | INTEGER | DEFAULT 0 |
positive_replies_current_month | INTEGER | DEFAULT 0 |
positive_replies_last_7_days | INTEGER | DEFAULT 0 |
positive_replies_last_14_days | INTEGER | DEFAULT 0 |
positive_replies_last_30_days | INTEGER | DEFAULT 0 |
positive_replies_last_month | INTEGER | DEFAULT 0 |
all_replies_mtd | INTEGER | DEFAULT 0 |
bounced_mtd | INTEGER | DEFAULT 0 |
unsubscribed_mtd | INTEGER | DEFAULT 0 |
projection_emails_eom | INTEGER | DEFAULT 0 |
projection_positive_replies_eom | INTEGER | DEFAULT 0 |
mtd_leads_progress | DECIMAL(5,2) | DEFAULT 0 |
projection_replies_progress | DECIMAL(5,2) | DEFAULT 0 |
last_week_vs_week_before_progress | DECIMAL(5,2) | DEFAULT 0 |
created_at | TIMESTAMPTZ | DEFAULT now() |
updated_at | TIMESTAMPTZ | DEFAULT now() |
monthly_daily_revenue_history
Defined in: 037_thomas_migration_compat.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
month_year | TEXT | NOT NULL |
day | INTEGER | NOT NULL |
date | DATE | |
daily_revenue | DECIMAL(10,2) | DEFAULT 0 |
cumulative_revenue | DECIMAL(10,2) | DEFAULT 0 |
lead_count | INTEGER | DEFAULT 0 |
created_at | TIMESTAMPTZ | DEFAULT now() |
workspace_stats_cache
*Pre-computed workspace KPIs rebuilt after every Bison sync. *
Defined in: 042_workspace_stats_cache.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
display_name | TEXT | |
stat_date | DATE | NOT NULL DEFAULT CURRENT_DATE |
emails_sent | BIGINT | NOT NULL DEFAULT 0 |
total_leads_contacted | BIGINT | NOT NULL DEFAULT 0 |
opened | BIGINT | NOT NULL DEFAULT 0 |
unique_replies | BIGINT | NOT NULL DEFAULT 0 |
bounced | BIGINT | NOT NULL DEFAULT 0 |
interested | BIGINT | NOT NULL DEFAULT 0 |
not_interested | BIGINT | NOT NULL DEFAULT 0 |
unsubscribed | BIGINT | NOT NULL DEFAULT 0 |
open_rate | NUMERIC(6,2) | NOT NULL DEFAULT 0 |
reply_rate | NUMERIC(6,2) | NOT NULL DEFAULT 0 |
bounce_rate | NUMERIC(6,2) | NOT NULL DEFAULT 0 |
interested_percentage | NUMERIC(6,2) | NOT NULL DEFAULT 0 |
cache_type | TEXT | NOT NULL DEFAULT 'current' |
synced_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
pipeline_stats_cache
Pre-computed pipeline statistics per workspace per month. Refreshed by Celery workers after pipeline stage completions and every 5 minutes by Celery Beat.
Defined in: 044_pipeline_stats_cache_table.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
month | TEXT | NOT NULL |
total_contacts | BIGINT | DEFAULT 0 |
pending | BIGINT | DEFAULT 0 |
filtered_out | BIGINT | DEFAULT 0 |
ready_for_verification | BIGINT | DEFAULT 0 |
verifying | BIGINT | DEFAULT 0 |
verified | BIGINT | DEFAULT 0 |
invalid | BIGINT | DEFAULT 0 |
unknown | BIGINT | DEFAULT 0 |
source_scraped | BIGINT | DEFAULT 0 |
source_uploaded | BIGINT | DEFAULT 0 |
source_master_db | BIGINT | DEFAULT 0 |
total_verified | BIGINT | DEFAULT 0 |
uploaded | BIGINT | DEFAULT 0 |
pending_upload | BIGINT | DEFAULT 0 |
rejected | BIGINT | DEFAULT 0 |
failed | BIGINT | DEFAULT 0 |
deliverable_count | BIGINT | DEFAULT 0 |
undeliverable_count | BIGINT | DEFAULT 0 |
risky_count | BIGINT | DEFAULT 0 |
updated_at | TIMESTAMPTZ | DEFAULT now() |
workspace_daily_stats
Daily incremental metrics per workspace from Bison chart API. Used for charts and date-filtered KPIs.
Defined in: 045_workspace_daily_stats.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
stat_date | DATE | NOT NULL |
sent | BIGINT | NOT NULL DEFAULT 0 |
replied | BIGINT | NOT NULL DEFAULT 0 |
interested | BIGINT | NOT NULL DEFAULT 0 |
bounced | BIGINT | NOT NULL DEFAULT 0 |
total_opens | BIGINT | NOT NULL DEFAULT 0 |
unique_opens | BIGINT | NOT NULL DEFAULT 0 |
unsubscribed | BIGINT | NOT NULL DEFAULT 0 |
synced_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
reseller_configs
Defined in: 048_infrastructure_orders.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
reseller_name | TEXT | NOT NULL |
display_name | TEXT | NOT NULL |
account_type | TEXT | NOT NULL |
account_type_display | TEXT | NOT NULL |
bison_provider_tag | TEXT | NOT NULL |
bison_reseller_tag | TEXT | NOT NULL |
max_send_per_day | INTEGER | NOT NULL |
warmup_volume_per_day | INTEGER | NOT NULL |
warmup_period_days | INTEGER | NOT NULL |
ramp_start | INTEGER | NOT NULL |
ramp_increment | INTEGER | NOT NULL |
ramp_increment_interval_days | INTEGER | NOT NULL DEFAULT 1 |
cost_per_inbox | DECIMAL(10,2) | |
is_active | BOOLEAN | DEFAULT true |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
infrastructure_orders
Defined in: 048_infrastructure_orders.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL REFERENCES public.client_registry(workspace_name) |
reseller_config_id | INTEGER | NOT NULL REFERENCES public.reseller_configs(id) |
quantity | INTEGER | NOT NULL |
emails_per_inbox_per_day | INTEGER | NOT NULL |
stage | TEXT | NOT NULL DEFAULT 'order_placed' |
expected_provider_tag | TEXT | |
expected_reseller_tag | TEXT | |
expected_date_tag | TEXT | |
fulfilled_at | TIMESTAMPTZ | |
fulfilled_account_count | INTEGER | DEFAULT 0 |
warmup_verified_at | TIMESTAMPTZ | |
launch_date | DATE | |
ramp_started_at | TIMESTAMPTZ | |
completed_at | TIMESTAMPTZ | |
matched_account_ids | JSONB | DEFAULT '[]'::jsonb |
notes | TEXT | |
created_by | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
infrastructure_order_events
Defined in: 048_infrastructure_orders.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
order_id | INTEGER | NOT NULL REFERENCES public.infrastructure_orders(id) ON DELETE CASCADE |
from_stage | TEXT | |
to_stage | TEXT | NOT NULL |
event_type | TEXT | NOT NULL |
detail | TEXT | |
created_by | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
onboarding_drafts
Defined in: 052_onboarding_drafts.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | DEFAULT gen_random_uuid() PRIMARY KEY |
created_by | UUID | REFERENCES auth.users(id) |
wizard_state | JSONB | NOT NULL DEFAULT '{}' |
current_step | INTEGER | NOT NULL DEFAULT 1 |
workspace_name | TEXT | |
display_name | TEXT | |
status | TEXT | NOT NULL DEFAULT 'in_progress' CHECK (status IN ('in_progress', 'completed', 'abandoned')) |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
agent_threads
Defined in: 053_agent_conversations.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | DEFAULT gen_random_uuid() PRIMARY KEY |
user_id | UUID | NOT NULL REFERENCES auth.users(id) |
title | TEXT | |
session_id | TEXT | |
is_archived | BOOLEAN | DEFAULT false |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
agent_messages
Defined in: 053_agent_conversations.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | DEFAULT gen_random_uuid() PRIMARY KEY |
thread_id | UUID | NOT NULL REFERENCES agent_threads(id) ON DELETE CASCADE |
role | TEXT | NOT NULL CHECK (role IN ('user', 'assistant', 'system')) |
content | TEXT | |
tool_calls | JSONB | |
token_usage | JSONB | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
task_events
Lightweight task event log for status page. Auto-pruned to 7 days.
Defined in: 059_task_events.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
task_id | TEXT | NOT NULL |
task_name | TEXT | NOT NULL |
queue | TEXT | |
status | TEXT | NOT NULL CHECK (status IN ('started', 'succeeded', 'failed', 'retried')) |
error_message | TEXT | |
duration_seconds | FLOAT | |
worker | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
hall_of_fame_nominations
Defined in: 060_hall_of_fame.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | DEFAULT gen_random_uuid() PRIMARY KEY |
lead_reply_id | UUID | NOT NULL REFERENCES public.lead_replies(id) ON DELETE CASCADE |
category | TEXT | NOT NULL CHECK (category IN ('funny', 'rude', 'wholesome', 'creative', 'unhinged')) |
nominated_by | TEXT | NOT NULL, -- user email or 'ai_system' |
nomination_source | TEXT | NOT NULL DEFAULT 'manual' |
ai_confidence | INTEGER, | -- 0-100, only for ai_detected |
note | TEXT, | -- optional comment from nominator |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | NOT NULL |
reply_text | TEXT | NOT NULL |
reply_date | TIMESTAMPTZ | NOT NULL |
vote_count | INTEGER | NOT NULL DEFAULT 0, -- materialized via trigger |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
hall_of_fame_votes
Defined in: 060_hall_of_fame.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | DEFAULT gen_random_uuid() PRIMARY KEY |
nomination_id | UUID | NOT NULL REFERENCES public.hall_of_fame_nominations(id) ON DELETE CASCADE |
user_email | TEXT | NOT NULL |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
task_activity
Defined in: 060_tasks_v2.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
task_id | UUID | NOT NULL REFERENCES public.tasks(id) ON DELETE CASCADE |
event_type | TEXT | NOT NULL CHECK (event_type IN ( |
actor_id | UUID | REFERENCES public.user_profiles(id) |
payload | JSONB | DEFAULT '{}'::jsonb |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
ai_generation_log
Defined in: 064_reply_ai_upgrade.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | DEFAULT gen_random_uuid() PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
lead_reply_id | UUID | |
task_type | TEXT | NOT NULL |
model | TEXT | NOT NULL |
prompt_tokens | INT | |
completion_tokens | INT | |
estimated_cost_usd | NUMERIC(10, | 6) |
latency_ms | INT | |
intent | TEXT | |
tone | TEXT | |
success | BOOLEAN | DEFAULT TRUE |
error_message | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
prompt_eval_results
Defined in: 064_reply_ai_upgrade.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | DEFAULT gen_random_uuid() PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
eval_type | TEXT | NOT NULL |
total_tests | INT | NOT NULL |
passed | INT | NOT NULL |
failed | INT | NOT NULL |
results | JSONB | NOT NULL |
model_used | TEXT | |
triggered_by | TEXT | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
crm_destinations
*Multi-destination CRM routing. Each row represents one CRM destination *
Defined in: 065_crm_destinations.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
campaign_id | INT | |
crm_type | TEXT | NOT NULL |
external_api_url | TEXT | NOT NULL |
external_api_token | TEXT | |
crm_params | JSONB | NOT NULL DEFAULT '{}'::jsonb |
label | TEXT | |
is_active | BOOLEAN | NOT NULL DEFAULT TRUE |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
resources
*Global content library shown on the /resources page. Visible to every *
Defined in: 072_resources.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
title | TEXT | NOT NULL |
description | TEXT | |
category | TEXT | NOT NULL |
resource_type | TEXT | NOT NULL |
loom_url | TEXT | |
article_content | TEXT | |
pdf_storage_path | TEXT | |
thumbnail_url | TEXT | |
published | BOOLEAN | NOT NULL DEFAULT TRUE |
created_by | UUID | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
AND | article_content | IS NULL AND pdf_storage_path IS NULL) |
AND | loom_url | IS NULL AND pdf_storage_path IS NULL) |
AND | loom_url | IS NULL AND article_content IS NULL) |
resource_requests
*Topic/video requests submitted by clients via the Resources page. *
Defined in: 072_resources.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
requester_user_id | UUID | NOT NULL |
requester_email | TEXT | NOT NULL |
workspace_name | TEXT | |
topic | TEXT | NOT NULL |
requested_format | TEXT | NOT NULL |
description | TEXT | |
status | TEXT | NOT NULL DEFAULT 'requested' |
fulfilled_resource_id | UUID | REFERENCES resources(id) ON DELETE SET NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
revenue_refunds
Defined in: 073_revenue_adjustments.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | DEFAULT gen_random_uuid() PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
month | TEXT | NOT NULL CHECK (month ~ '^\d{4}-(0[1-9]|1[0-2])$') |
lead_name | TEXT | NOT NULL |
lead_email | TEXT | |
reason | TEXT | |
amount_override | NUMERIC(10, | 2) |
price_per_lead_snapshot | NUMERIC(10, | 2) |
created_by | UUID | REFERENCES auth.users(id) ON DELETE SET NULL |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
revenue_referrals
Defined in: 073_revenue_adjustments.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | DEFAULT gen_random_uuid() PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
month | TEXT | NOT NULL CHECK (month ~ '^\d{4}-(0[1-9]|1[0-2])$') |
referred_party | TEXT | |
credit_amount | NUMERIC(10, | 2) NOT NULL DEFAULT 500 |
notes | TEXT | |
created_by | UUID | REFERENCES auth.users(id) ON DELETE SET NULL |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
task_timeline
Defined in: 073_task_timeline.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
task_id | UUID | NOT NULL REFERENCES public.tasks(id) ON DELETE CASCADE |
kind | TEXT | NOT NULL CHECK (kind IN ('system', 'comment')) |
event_type | TEXT | CHECK (event_type IN ( |
payload | JSONB | DEFAULT '{}'::jsonb |
body | TEXT | |
edited_at | TIMESTAMPTZ | |
deleted_at | TIMESTAMPTZ | |
slack_message_ts | TEXT | |
actor_id | UUID | REFERENCES public.user_profiles(id) |
source | TEXT | NOT NULL DEFAULT 'dashboard' |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
slack_event_dedup
Defined in: 076_slack_event_dedup.sql
| Column | Type | Constraints |
|---|---|---|
event_id | TEXT | PRIMARY KEY |
processed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_verticals
*Per-vertical configuration for audit discovery + ranking. JSONB regex *
Defined in: 079_audit_phase_a_config_tables.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | PRIMARY KEY |
display_name | TEXT | NOT NULL |
discovery_include_patterns | JSONB | NOT NULL DEFAULT '[]'::jsonb |
discovery_exclude_patterns | JSONB | NOT NULL DEFAULT '[]'::jsonb |
default_thresholds | JSONB | NOT NULL DEFAULT '{}'::jsonb |
enabled | BOOLEAN | NOT NULL DEFAULT true |
notes | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_recommendation_rules
*Tunable thresholds per (loop_type, vertical_id). audit.generate_recommendations *
Defined in: 079_audit_phase_a_config_tables.sql
| Column | Type | Constraints |
|---|---|---|
rule_id | BIGSERIAL | PRIMARY KEY |
loop_type | TEXT | NOT NULL CHECK (loop_type IN ( |
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE RESTRICT |
threshold_json | JSONB | NOT NULL DEFAULT '{}'::jsonb |
enabled | BOOLEAN | NOT NULL DEFAULT true |
notes | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_sync_state
*Per-(workspace, campaign, stage) ingest checkpoint. Drives incremental *
Defined in: 079_audit_phase_a_config_tables.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
campaign_id | TEXT | NOT NULL |
stage | TEXT | NOT NULL CHECK (stage IN ( |
vertical_id | TEXT | REFERENCES audit_verticals(vertical_id) ON DELETE SET NULL |
last_audited_at | TIMESTAMPTZ | |
last_status | TEXT | NOT NULL DEFAULT 'pending' CHECK (last_status IN ( |
last_error | TEXT | |
rows_processed | INTEGER | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_rank_by_subject
Per-subject leaderboard. Rebuilt nightly by audit.aggregate_rankings.
Defined in: 080_audit_phase_a_rank_tables.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE CASCADE |
subject_norm | TEXT | NOT NULL |
sends | INTEGER | NOT NULL DEFAULT 0 |
interested | INTEGER | NOT NULL DEFAULT 0 |
any_reply | INTEGER | NOT NULL DEFAULT 0 |
interested_rate_pct | NUMERIC(8,4) | |
any_reply_rate_pct | NUMERIC(8,4) | |
interested_rate_lower_pct | NUMERIC(8,4) | |
interested_rate_upper_pct | NUMERIC(8,4) | |
below_threshold | BOOLEAN | NOT NULL DEFAULT false |
last_computed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_rank_by_pitch
Per-pitch_body_fingerprint leaderboard. Rebuilt nightly.
Defined in: 080_audit_phase_a_rank_tables.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE CASCADE |
pitch_body_fingerprint | TEXT | NOT NULL |
sends | INTEGER | NOT NULL DEFAULT 0 |
interested | INTEGER | NOT NULL DEFAULT 0 |
any_reply | INTEGER | NOT NULL DEFAULT 0 |
interested_rate_pct | NUMERIC(8,4) | |
any_reply_rate_pct | NUMERIC(8,4) | |
interested_rate_lower_pct | NUMERIC(8,4) | |
interested_rate_upper_pct | NUMERIC(8,4) | |
below_threshold | BOOLEAN | NOT NULL DEFAULT false |
last_computed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_rank_by_parent_template
Per-parent-template leaderboard. Rebuilt nightly.
Defined in: 080_audit_phase_a_rank_tables.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE CASCADE |
parent_template_id | TEXT | NOT NULL |
sends | INTEGER | NOT NULL DEFAULT 0 |
interested | INTEGER | NOT NULL DEFAULT 0 |
any_reply | INTEGER | NOT NULL DEFAULT 0 |
interested_rate_pct | NUMERIC(8,4) | |
any_reply_rate_pct | NUMERIC(8,4) | |
interested_rate_lower_pct | NUMERIC(8,4) | |
interested_rate_upper_pct | NUMERIC(8,4) | |
below_threshold | BOOLEAN | NOT NULL DEFAULT false |
last_computed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_rank_by_master_template
Per-master-template-family leaderboard. Rebuilt nightly.
Defined in: 080_audit_phase_a_rank_tables.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE CASCADE |
master_template_id | TEXT | NOT NULL |
sends | INTEGER | NOT NULL DEFAULT 0 |
interested | INTEGER | NOT NULL DEFAULT 0 |
any_reply | INTEGER | NOT NULL DEFAULT 0 |
interested_rate_pct | NUMERIC(8,4) | |
any_reply_rate_pct | NUMERIC(8,4) | |
interested_rate_lower_pct | NUMERIC(8,4) | |
interested_rate_upper_pct | NUMERIC(8,4) | |
below_threshold | BOOLEAN | NOT NULL DEFAULT false |
last_computed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_rank_by_step
Per-step-position rollup across all campaigns. Rebuilt nightly.
Defined in: 080_audit_phase_a_rank_tables.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE CASCADE |
step_position | INTEGER | NOT NULL CHECK (step_position >= 1) |
sends | INTEGER | NOT NULL DEFAULT 0 |
interested | INTEGER | NOT NULL DEFAULT 0 |
any_reply | INTEGER | NOT NULL DEFAULT 0 |
interested_rate_pct | NUMERIC(8,4) | |
any_reply_rate_pct | NUMERIC(8,4) | |
interested_rate_lower_pct | NUMERIC(8,4) | |
interested_rate_upper_pct | NUMERIC(8,4) | |
below_threshold | BOOLEAN | NOT NULL DEFAULT false |
last_computed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_rank_by_sender_combo
(local_pattern × domain_prefix × domain_suffix × legal_suffix) grid for mailbox ordering recs.
Defined in: 080_audit_phase_a_rank_tables.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE CASCADE |
local_pattern | TEXT | NOT NULL |
domain_prefix_token | TEXT | NOT NULL |
domain_suffix_token | TEXT | NOT NULL |
legal_suffix_flag | BOOLEAN | NOT NULL DEFAULT false |
mailbox_count | INTEGER | NOT NULL DEFAULT 0 |
domain_count | INTEGER | NOT NULL DEFAULT 0 |
emails_sent | INTEGER | NOT NULL DEFAULT 0 |
unique_replied | INTEGER | NOT NULL DEFAULT 0 |
bounced | INTEGER | NOT NULL DEFAULT 0 |
unsubscribed | INTEGER | NOT NULL DEFAULT 0 |
origin_interested | INTEGER | NOT NULL DEFAULT 0 |
origin_any_reply | INTEGER | NOT NULL DEFAULT 0 |
interested_per_send_pct | NUMERIC(8,4) | |
reply_rate_pct | NUMERIC(8,4) | |
bounce_rate_pct | NUMERIC(8,4) | |
interested_per_send_lower_pct | NUMERIC(8,4) | |
interested_per_send_upper_pct | NUMERIC(8,4) | |
reply_rate_lower_pct | NUMERIC(8,4) | |
below_threshold | BOOLEAN | NOT NULL DEFAULT false |
last_computed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_rank_by_sender_domain
Per-domain sender rollup.
Defined in: 080_audit_phase_a_rank_tables.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE CASCADE |
domain | TEXT | NOT NULL |
mailbox_count | INTEGER | NOT NULL DEFAULT 0 |
emails_sent | INTEGER | NOT NULL DEFAULT 0 |
unique_replied | INTEGER | NOT NULL DEFAULT 0 |
bounced | INTEGER | NOT NULL DEFAULT 0 |
unsubscribed | INTEGER | NOT NULL DEFAULT 0 |
origin_interested | INTEGER | NOT NULL DEFAULT 0 |
origin_any_reply | INTEGER | NOT NULL DEFAULT 0 |
interested_per_send_pct | NUMERIC(8,4) | |
reply_rate_pct | NUMERIC(8,4) | |
bounce_rate_pct | NUMERIC(8,4) | |
interested_per_send_lower_pct | NUMERIC(8,4) | |
interested_per_send_upper_pct | NUMERIC(8,4) | |
reply_rate_lower_pct | NUMERIC(8,4) | |
below_threshold | BOOLEAN | NOT NULL DEFAULT false |
last_computed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_rank_by_sender_local_pattern
Per local-part naming-pattern rollup.
Defined in: 080_audit_phase_a_rank_tables.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE CASCADE |
local_pattern | TEXT | NOT NULL |
mailbox_count | INTEGER | NOT NULL DEFAULT 0 |
domain_count | INTEGER | NOT NULL DEFAULT 0 |
emails_sent | INTEGER | NOT NULL DEFAULT 0 |
unique_replied | INTEGER | NOT NULL DEFAULT 0 |
bounced | INTEGER | NOT NULL DEFAULT 0 |
unsubscribed | INTEGER | NOT NULL DEFAULT 0 |
origin_interested | INTEGER | NOT NULL DEFAULT 0 |
origin_any_reply | INTEGER | NOT NULL DEFAULT 0 |
interested_per_send_pct | NUMERIC(8,4) | |
reply_rate_pct | NUMERIC(8,4) | |
bounce_rate_pct | NUMERIC(8,4) | |
interested_per_send_lower_pct | NUMERIC(8,4) | |
interested_per_send_upper_pct | NUMERIC(8,4) | |
reply_rate_lower_pct | NUMERIC(8,4) | |
below_threshold | BOOLEAN | NOT NULL DEFAULT false |
last_computed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_recommendations
*Action layer output. Written by audit.generate_recommendations nightly. *
Defined in: 081_audit_phase_a_action_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE RESTRICT |
workspace_name | TEXT | NOT NULL |
loop_type | TEXT | NOT NULL CHECK (loop_type IN ( |
status | TEXT | NOT NULL DEFAULT 'new' CHECK (status IN ( |
evidence_payload | JSONB | NOT NULL DEFAULT '{}'::jsonb |
proposed_action | JSONB | NOT NULL DEFAULT '{}'::jsonb |
projected_lift_pp | NUMERIC(8,4) | |
wilson_lower_current_pct | NUMERIC(8,4) | |
wilson_lower_proposed_pct | NUMERIC(8,4) | |
generated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
expires_at | TIMESTAMPTZ | NOT NULL DEFAULT (NOW() + INTERVAL '30 days') |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_deployments
*When a recommendation was acted on. signal_source distinguishes auto-detected *
Defined in: 081_audit_phase_a_action_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
recommendation_id | BIGINT | NOT NULL REFERENCES audit_recommendations(id) ON DELETE CASCADE |
signal_source | TEXT | NOT NULL CHECK (signal_source IN ('auto', 'manual')) |
allocation_pct | NUMERIC(5,2) | NOT NULL DEFAULT 100 |
deployed_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
deployed_by | TEXT | |
notes | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_outcomes
Post-deploy Wilson CI verdict, written by audit.measure_outcomes 14d after deploy.
Defined in: 081_audit_phase_a_action_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
deployment_id | BIGINT | NOT NULL REFERENCES audit_deployments(id) ON DELETE CASCADE |
measured_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
sample_size_post | INTEGER | NOT NULL DEFAULT 0 |
interested_post | INTEGER | NOT NULL DEFAULT 0 |
interested_rate_post_pct | NUMERIC(8,4) | |
wilson_lower_post_pct | NUMERIC(8,4) | |
wilson_upper_post_pct | NUMERIC(8,4) | |
verdict | TEXT | NOT NULL CHECK (verdict IN ( |
notes | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
xpressdocs_backfill_jobs
*One row per (state, month, zip_batch) scrape job for the 12-month bulk *
Defined in: 081_xpressdocs_bulk_backfill.sql
| Column | Type | Constraints |
|---|---|---|
job_id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
state | TEXT | NOT NULL |
month_year | TEXT | NOT NULL, -- e.g. '2026-06' |
month_name | TEXT | NOT NULL, -- e.g. 'June' |
zip_batch | TEXT[] | NOT NULL, -- up to 25 ZIPs |
zip_batch_hash | TEXT | NOT NULL, -- SHA256(sorted batch) for uniqueness |
credential_id | INTEGER | NOT NULL REFERENCES site_credentials(id) ON DELETE RESTRICT |
credential_username | TEXT | NOT NULL |
status | TEXT | NOT NULL DEFAULT 'pending' |
attempts | INTEGER | NOT NULL DEFAULT 0 |
last_error | TEXT | |
scraping_job_id | UUID | REFERENCES scraping_jobs(job_id) ON DELETE SET NULL |
records_downloaded | INTEGER | |
storage_paths | TEXT[] | |
hetzner_synced_at | TIMESTAMPTZ | |
hetzner_rows_inserted | INTEGER | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_replies
*Per-reply data ingested from Bison /api/campaigns/{id}/replies. *
Defined in: 082_audit_phase_a_replies_origins.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
bison_reply_id | BIGINT | NOT NULL |
campaign_id | TEXT | NOT NULL |
scheduled_email_id | BIGINT, | -- FK reference (logical) to audit_origins |
folder | TEXT, | -- 'interested', 'positive', 'maybe', etc. from Bison |
is_interested | BOOLEAN | |
sentiment | TEXT | |
lead_id | BIGINT | |
lead_email | TEXT | |
sender_email_id | BIGINT | |
sender_email | TEXT | |
received_at | TIMESTAMPTZ | |
raw_payload | JSONB | |
last_synced_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_origins
*Slim copy of /api/scheduled-emails/{id} for every reply origin. *
Defined in: 082_audit_phase_a_replies_origins.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
bison_scheduled_email_id | BIGINT | NOT NULL |
campaign_id | TEXT | |
sequence_step_id | BIGINT | |
thread_reply | BOOLEAN | |
email_subject | TEXT | |
email_body | TEXT, | -- kept for fingerprint / pitch analysis |
status | TEXT, | -- sent, scheduled, paused, etc. |
scheduled_date | TIMESTAMPTZ | |
sent_at | TIMESTAMPTZ | |
opens | INTEGER | |
clicks | INTEGER | |
replies | INTEGER | |
interested | INTEGER | |
unique_replies | INTEGER | |
unique_opens | INTEGER | |
raw_message_id | TEXT | |
lead_id | BIGINT | |
lead_email | TEXT | |
lead_first_name | TEXT | |
lead_last_name | TEXT | |
lead_company | TEXT | |
sender_email_id | BIGINT | |
sender_email | TEXT | |
last_synced_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_step_stats
*Daily snapshot of per-step Bison campaign stats. Drives ranking aggregations. *
Defined in: 083_audit_phase_a_step_stats.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
campaign_id | TEXT | NOT NULL |
sequence_step_id | BIGINT | NOT NULL |
stat_date | DATE | NOT NULL |
email_subject | TEXT | |
sent | INTEGER | NOT NULL DEFAULT 0 |
leads_contacted | INTEGER | NOT NULL DEFAULT 0 |
unique_replies | INTEGER | NOT NULL DEFAULT 0 |
interested | INTEGER | NOT NULL DEFAULT 0 |
bounced | INTEGER | NOT NULL DEFAULT 0 |
unsubscribed | INTEGER | NOT NULL DEFAULT 0 |
unique_opens | INTEGER | NOT NULL DEFAULT 0 |
last_synced_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_senders
*Per-mailbox Bison sender info with parsed naming-pattern fields. *
Defined in: 084_audit_phase_a_senders.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
sender_email_id | BIGINT | NOT NULL |
email | TEXT | NOT NULL |
local_pattern | TEXT, | -- e.g. 'first.last', 'flast', 'fl' |
domain | TEXT | |
domain_prefix_token | TEXT, | -- first token, e.g. 'ask' in askwallaceagency |
domain_business_type | TEXT, | -- 'agency' | 'insurance' | NULL |
domain_modifier_suffix | TEXT, | -- 'corp' | 'team' | 'pro' | NULL |
domain_legal_suffix | TEXT, | -- 'llc' | 'inc' | NULL |
legal_suffix_flag | BOOLEAN | NOT NULL DEFAULT false |
status | TEXT, | -- 'active' | 'paused' | 'archived' | ... |
name | TEXT | |
lifetime_emails_sent | INTEGER | NOT NULL DEFAULT 0 |
unique_replied | INTEGER | NOT NULL DEFAULT 0 |
bounced | INTEGER | NOT NULL DEFAULT 0 |
unsubscribed | INTEGER | NOT NULL DEFAULT 0 |
interested_leads_count | INTEGER | NOT NULL DEFAULT 0 |
created_at_bison | TIMESTAMPTZ | |
updated_at_bison | TIMESTAMPTZ | |
last_synced_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
email_account_daily_stats
*Per-email-account daily snapshot for rolling-30-day burn detection. *
Defined in: 084_email_account_daily_stats.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
email_address | TEXT | NOT NULL |
workspace_name | TEXT | NOT NULL |
stat_date | DATE | NOT NULL |
sent | INTEGER | NOT NULL DEFAULT 0 |
replied | INTEGER | NOT NULL DEFAULT 0 |
bounced | INTEGER | NOT NULL DEFAULT 0 |
interested | INTEGER | NOT NULL DEFAULT 0 |
cumulative_sent_at_eod | INTEGER | NOT NULL DEFAULT 0 |
cumulative_replied_at_eod | INTEGER | NOT NULL DEFAULT 0 |
cumulative_bounced_at_eod | INTEGER | NOT NULL DEFAULT 0 |
cumulative_interested_at_eod | INTEGER | NOT NULL DEFAULT 0 |
delta_anomaly | BOOLEAN | NOT NULL DEFAULT FALSE |
synced_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_briefings
*Per-client rendered Markdown briefings. Written nightly by *
Defined in: 086_audit_phase_a_briefings.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE RESTRICT |
generated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
markdown_content | TEXT | NOT NULL |
summary_json | JSONB | NOT NULL DEFAULT '{}'::jsonb |
content_bytes | INTEGER | GENERATED ALWAYS AS (length(markdown_content)) STORED |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
workspace_volume_tracking
Per-workspace intraday tracking of Bison emails_being_sent (max + current + initial + min) and end-of-day actual sent. Powers the Drop % column in the KPI Daily Recap table.
Defined in: 087_workspace_volume_tracking.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
tracking_date | DATE | NOT NULL |
scheduled_max | INTEGER | NOT NULL DEFAULT 0 |
scheduled_max_at | TIMESTAMPTZ | |
scheduled_min | INTEGER | |
scheduled_min_at | TIMESTAMPTZ | |
scheduled_initial | INTEGER | |
scheduled_initial_at | TIMESTAMPTZ | |
scheduled_current | INTEGER | |
scheduled_current_at | TIMESTAMPTZ | |
emails_sent_final | INTEGER | |
poll_count | INTEGER | NOT NULL DEFAULT 0 |
poll_failures | INTEGER | NOT NULL DEFAULT 0 |
last_polled_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
billing_subscriptions
Defined in: 090_billing_audit.sql
| Column | Type | Constraints |
|---|---|---|
stripe_subscription_id | TEXT | PRIMARY KEY, -- "si_UBTe4d0OJExEYU" |
client_name | TEXT | NOT NULL, -- "Jason Park Missouri" |
workspace_name | TEXT, | -- normalized snake_case, joinable to client_registry |
service_type | TEXT | NOT NULL, -- "Azure" | "Google Direct" | "Google Legacy" | "Outlook 365" |
mailboxes | INTEGER | NOT NULL DEFAULT 0, -- raw mailbox count from sheet |
billable_units | INTEGER | NOT NULL DEFAULT 0, -- mailboxes / 99 for Azure, else == mailboxes |
unit_label | TEXT | NOT NULL DEFAULT 'inbox', -- "domain" for Azure, "inbox" otherwise |
rate | NUMERIC(10,4) | NOT NULL DEFAULT 0, -- $/unit |
expected_amount | NUMERIC(10,2) | NOT NULL DEFAULT 0, -- billable_units * rate |
billing_day | INTEGER, | -- 1-31, parsed from cycle text; nullable |
cycle_text_raw | TEXT, | -- "every 20th of the month" |
status | TEXT | NOT NULL DEFAULT 'active' |
invoice_prefix | TEXT, | -- inferred from first matched receipt (e.g. "X1S1A4K4") |
sheet_row_hash | TEXT, | -- for diff detection |
synced_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
billing_receipts
Defined in: 090_billing_audit.sql
| Column | Type | Constraints |
|---|---|---|
receipt_number | TEXT | PRIMARY KEY, -- "2901-7555" |
invoice_number | TEXT, | -- "X1S1A4K4-0004" |
invoice_prefix | TEXT, | -- "X1S1A4K4" (derived from invoice_number) |
invoice_sequence | INTEGER, | -- 4 (derived) |
gmail_message_id | TEXT | UNIQUE, -- Gmail API msg id (dedup key for ingestion) |
paid_at | DATE | NOT NULL |
period_start | DATE, | -- "May 24" (year inferred from paid_at) |
period_end | DATE, | -- "Jun 24" |
qty | INTEGER | NOT NULL |
rate | NUMERIC(10,4) | NOT NULL |
total | NUMERIC(10,2) | NOT NULL |
payment_method_last4 | TEXT, | -- "9460" |
raw_subject | TEXT | |
raw_snippet | TEXT, | -- first ~500 chars of body, for debugging |
matched_subscription_id | TEXT | REFERENCES billing_subscriptions(stripe_subscription_id) ON DELETE SET NULL |
match_confidence | TEXT, | -- 'invoice_prefix' | 'signature_unique' | 'signature_with_date' | 'signature_round_robin' | 'operator' | 'unmatched' | 'duplicate' | 'off_rate' |
match_notes | TEXT | |
candidates_json | JSONB, | -- when ambiguous, list of candidate sub IDs |
resolved_at | TIMESTAMPTZ, | -- when an operator confirmed/overrode |
resolved_by | TEXT | |
ingested_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
billing_disputes
Defined in: 090_billing_audit.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
receipt_number | TEXT | REFERENCES billing_receipts(receipt_number) ON DELETE CASCADE |
dispute_type | TEXT | NOT NULL, -- 'duplicate' | 'off_rate' | 'unbilled_sub' | 'amount_mismatch' |
status | TEXT | NOT NULL DEFAULT 'open', -- 'open' | 'contacted_reseller' | 'refunded' | 'dismissed' |
amount_disputed | NUMERIC(10,2) | |
notes | TEXT | |
opened_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
resolved_at | TIMESTAMPTZ | |
resolved_by | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_stage_runs
*Per-run health log for the audit pipeline. One row per (stage run): *
Defined in: 097_audit_stage_runs.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
stage | TEXT | NOT NULL |
workspace_name | TEXT | NULL |
status | TEXT | NOT NULL |
triggered_by | TEXT | NOT NULL DEFAULT 'beat' |
started_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
finished_at | TIMESTAMPTZ | NULL |
result | JSONB | NULL |
error | TEXT | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
interested_format_promotions
*Per-format promotion state for the interested-lead learning loop (Path A/B). *
Defined in: 109_interested_format_promotions.sql
| Column | Type | Constraints |
|---|---|---|
format_signature | text | PRIMARY KEY |
signal | text | NOT NULL |
surfaced | integer | NOT NULL DEFAULT 0 |
confirmations | integer | NOT NULL DEFAULT 0 |
precision | numeric(4,3) | NOT NULL DEFAULT 0 |
auto_mark | boolean | NOT NULL DEFAULT false |
promoted_at | timestamptz | |
updated_at | timestamptz | NOT NULL DEFAULT now() |
audit_workspace_pitches
Per-(workspace, campaign, step) pitch/subject map for recommendation targeting. Rebuilt nightly by audit.aggregate_rankings.
Defined in: 113_audit_workspace_pitches.sql
| Column | Type | Constraints |
|---|---|---|
vertical_id | TEXT | NOT NULL REFERENCES audit_verticals(vertical_id) ON DELETE CASCADE |
workspace_name | TEXT | NOT NULL |
campaign_id | TEXT | NOT NULL |
sequence_step_id | BIGINT | NOT NULL |
pitch_body_fingerprint | TEXT | |
subject_norm | TEXT | |
campaign_name | TEXT | |
sends | INTEGER | NOT NULL DEFAULT 0 |
interested | INTEGER | NOT NULL DEFAULT 0 |
any_reply | INTEGER | NOT NULL DEFAULT 0 |
last_computed_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
audit_audience_stats
Audience layer: reply outcomes by contact segment per workspace. Rebuilt nightly by rebuild_audit_audience_stats().
Defined in: 114_audit_audience_stats.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
dimension | TEXT | NOT NULL |
bucket | TEXT | NOT NULL |
bucket_order | INTEGER | NOT NULL DEFAULT 50 |
uploaded | INTEGER | NOT NULL DEFAULT 0 |
replied | INTEGER | NOT NULL DEFAULT 0 |
interested | INTEGER | NOT NULL DEFAULT 0 |
computed_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
carrier_scrub_runs
One row per carrier list-scrub cycle (client + carrier + renewal month). Backs the Carrier Scrub dashboard tracker.
Defined in: 115_carrier_list_scrub.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL REFERENCES client_registry(workspace_name) |
carrier | TEXT | NOT NULL CHECK (carrier IN ('allstate', 'farmers')) |
scrub_format | TEXT | NOT NULL, -- snapshot of the format used to generate |
target_month | TEXT | NOT NULL, -- renewal month, matches verified_contacts.month (e.g. 'July') |
status | TEXT | NOT NULL DEFAULT 'draft' |
sent_count | INTEGER, | -- rows in the generated outbound file |
survivor_count | INTEGER, | -- rows in the returned survivor file (Phase 2) |
removed_count | INTEGER, | -- sent_count - survivor_count (Phase 2) |
export_csv_path | TEXT, | -- supabase storage path of the outbound file |
return_csv_path | TEXT, | -- supabase storage path of the carrier's return file (Phase 2) |
sent_at | TIMESTAMPTZ | |
sent_by | TEXT, | -- email of the operator who marked it sent |
returned_at | TIMESTAMPTZ | |
applied_at | TIMESTAMPTZ | |
applied_by | TEXT, | -- email of the operator who confirmed suppression |
removed_contact_ids | JSONB | DEFAULT '[]'::jsonb |
suppression_batch_id | UUID | |
notes | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
carrier_affiliations
National person -> insurance carrier affiliation map, built from carrier-pulled (do-not-market) contacts. Used to pre-suppress known customers from future lists.
Defined in: 115_carrier_list_scrub.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
carrier | TEXT | NOT NULL CHECK (carrier IN ('allstate', 'farmers')) |
first_name | TEXT | |
last_name | TEXT | |
property_address | TEXT | |
property_city | TEXT | |
property_state | TEXT | |
property_zip | TEXT, | -- 5-digit |
email | TEXT, | -- if known from our side (return file has none) |
phone | TEXT | |
match_method | TEXT, | -- how we inferred the affiliation (name_zip | name_only | exact) |
source_run_id | UUID | REFERENCES carrier_scrub_runs(id) |
source_workspace | TEXT | |
first_seen_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
last_seen_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
spam_block_events
*Per-event log of "Message blocked" DSN bounces (Google spam-rejection). *
Defined in: 117_spam_block_events.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
sender_mailbox | TEXT, | -- e.g. "ashleydean@quotes.gaudioinsuranceinstant.com" |
sender_domain | TEXT, | -- root domain (last 2 parts) for grouping in rollups |
original_recipient | TEXT, | -- the lead's email address we were trying to reach |
campaign_name | TEXT | |
bounce_reason | TEXT, | -- short headline / type code from the payload (for forensics) |
detected_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
alert_window_id | UUID | |
alerted_at | TIMESTAMPTZ |
operating_source_accounts
Defined in: 118_email_conversation_operating_intake_setup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
source_system | TEXT | NOT NULL |
account_label | TEXT | NOT NULL |
account_identifier | TEXT | NOT NULL |
owner_user_id | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
scope_purpose | TEXT | NOT NULL |
ingest_enabled | BOOLEAN | NOT NULL DEFAULT false |
backfill_enabled | BOOLEAN | NOT NULL DEFAULT false |
retention_days | INTEGER | NULL |
credential_ref | TEXT | NULL |
config | JSONB | NOT NULL DEFAULT '{}'::jsonb |
last_sync_cursor | TEXT | NULL |
last_sync_at | TIMESTAMPTZ | NULL |
last_error | TEXT | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_source_events
Defined in: 118_email_conversation_operating_intake_setup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
source_system | TEXT | NOT NULL |
source_account_id | UUID | NOT NULL REFERENCES public.operating_source_accounts(id) ON DELETE CASCADE |
source_event_id | TEXT | NOT NULL |
dedupe_key | TEXT | NOT NULL |
thread_key | TEXT | NULL |
occurred_at | TIMESTAMPTZ | NOT NULL |
subject_or_title | TEXT | NULL |
participants | JSONB | NOT NULL DEFAULT '[]'::jsonb |
body_excerpt | TEXT | NULL |
body_summary | TEXT | NULL |
raw_pointer | TEXT | NULL |
raw_payload | JSONB | NOT NULL DEFAULT '{}'::jsonb |
redaction_status | TEXT | NOT NULL DEFAULT 'not_checked' |
ingested_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
processed_at | TIMESTAMPTZ | NULL |
processing_status | TEXT | NOT NULL DEFAULT 'received' |
error_message | TEXT | NULL |
operating_threads
Defined in: 118_email_conversation_operating_intake_setup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
source_system | TEXT | NOT NULL |
source_account_id | UUID | NOT NULL REFERENCES public.operating_source_accounts(id) ON DELETE CASCADE |
thread_key | TEXT | NOT NULL |
subject_or_title | TEXT | NULL |
started_at | TIMESTAMPTZ | NULL |
last_activity_at | TIMESTAMPTZ | NULL |
participants | JSONB | NOT NULL DEFAULT '[]'::jsonb |
latest_summary | TEXT | NULL |
latest_summary_at | TIMESTAMPTZ | NULL |
primary_client_workspace_name | TEXT | NULL |
primary_entity_id | UUID | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_thread_messages
Defined in: 118_email_conversation_operating_intake_setup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
thread_id | UUID | NOT NULL REFERENCES public.operating_threads(id) ON DELETE CASCADE |
source_event_id | UUID | NOT NULL REFERENCES public.operating_source_events(id) ON DELETE CASCADE |
message_key | TEXT | NOT NULL |
occurred_at | TIMESTAMPTZ | NOT NULL |
sender | JSONB | NULL |
recipients | JSONB | NOT NULL DEFAULT '[]'::jsonb |
message_kind | TEXT | NOT NULL |
subject_or_title | TEXT | NULL |
snippet | TEXT | NULL |
summary | TEXT | NULL |
artifact_count | INTEGER | NOT NULL DEFAULT 0 |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_source_artifacts
Defined in: 118_email_conversation_operating_intake_setup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
source_event_id | UUID | NOT NULL REFERENCES public.operating_source_events(id) ON DELETE CASCADE |
source_artifact_id | TEXT | NOT NULL |
artifact_kind | TEXT | NOT NULL |
title | TEXT | NULL |
mime_type | TEXT | NULL |
source_url | TEXT | NULL |
storage_pointer | TEXT | NULL |
size_bytes | BIGINT | NULL |
checksum | TEXT | NULL |
redaction_status | TEXT | NOT NULL DEFAULT 'not_checked' |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_intake_runs
Defined in: 118_email_conversation_operating_intake_setup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
run_type | TEXT | NOT NULL |
source_system | TEXT | NOT NULL |
source_account_id | UUID | NULL REFERENCES public.operating_source_accounts(id) ON DELETE SET NULL |
started_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
finished_at | TIMESTAMPTZ | NULL |
status | TEXT | NOT NULL DEFAULT 'running' |
events_seen | INTEGER | NOT NULL DEFAULT 0 |
events_written | INTEGER | NOT NULL DEFAULT 0 |
events_ignored | INTEGER | NOT NULL DEFAULT 0 |
artifacts_written | INTEGER | NOT NULL DEFAULT 0 |
error_message | TEXT | NULL |
metadata | JSONB | NOT NULL DEFAULT '{}'::jsonb |
slack_conversations
Defined in: 118_slack_operating_intake_capture.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
team_id | TEXT | NOT NULL |
channel_id | TEXT | NOT NULL |
name | TEXT | |
is_private | BOOLEAN | NOT NULL DEFAULT false |
is_im | BOOLEAN | NOT NULL DEFAULT false |
is_mpim | BOOLEAN | NOT NULL DEFAULT false |
is_archived | BOOLEAN | NOT NULL DEFAULT false |
ingest_enabled | BOOLEAN | NOT NULL DEFAULT false |
client_id | INTEGER | NULL REFERENCES public.client_registry(workspace_id) ON DELETE SET NULL |
client_name | TEXT | NULL |
operating_domain | TEXT | NULL |
owner_user_id | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
slack_permalink_base | TEXT | NULL |
last_history_cursor | TEXT | NULL |
last_history_ts | TEXT | NULL |
last_swept_at | TIMESTAMPTZ | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
slack_users
Defined in: 118_slack_operating_intake_capture.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
team_id | TEXT | NOT NULL |
user_id | TEXT | NOT NULL |
name | TEXT | NULL |
real_name | TEXT | NULL |
is_bot | BOOLEAN | NOT NULL DEFAULT false |
is_deleted | BOOLEAN | NOT NULL DEFAULT false |
profile_json | JSONB | NOT NULL DEFAULT '{}'::jsonb |
user_profile_id | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
slack_events_raw
Defined in: 118_slack_operating_intake_capture.sql
| Column | Type | Constraints |
|---|---|---|
event_id | TEXT | PRIMARY KEY |
team_id | TEXT | NOT NULL |
api_app_id | TEXT | NULL |
event_type | TEXT | NOT NULL |
event_subtype | TEXT | NULL |
channel_id | TEXT | NULL |
user_id | TEXT | NULL |
message_ts | TEXT | NULL |
thread_ts | TEXT | NULL |
event_ts | TEXT | NULL |
event_time | BIGINT | NULL |
raw_payload | JSONB | NOT NULL |
received_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
processed_at | TIMESTAMPTZ | NULL |
processing_status | TEXT | NOT NULL DEFAULT 'received' |
error_message | TEXT | NULL |
slack_messages
Defined in: 118_slack_operating_intake_capture.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
team_id | TEXT | NOT NULL |
channel_id | TEXT | NOT NULL |
message_ts | TEXT | NOT NULL |
thread_ts | TEXT | NOT NULL |
user_id | TEXT | NULL |
bot_id | TEXT | NULL |
subtype | TEXT | NULL |
text | TEXT | NULL |
raw_message | JSONB | NOT NULL DEFAULT '{}'::jsonb |
permalink | TEXT | NULL |
is_thread_root | BOOLEAN | NOT NULL DEFAULT false |
is_deleted | BOOLEAN | NOT NULL DEFAULT false |
edited_at | TIMESTAMPTZ | NULL |
deleted_at | TIMESTAMPTZ | NULL |
latest_event_id | TEXT | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
slack_ingest_runs
Defined in: 118_slack_operating_intake_capture.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
run_type | TEXT | NOT NULL |
team_id | TEXT | NOT NULL |
channel_id | TEXT | NULL |
started_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
finished_at | TIMESTAMPTZ | NULL |
status | TEXT | NOT NULL DEFAULT 'running' |
messages_seen | INTEGER | NOT NULL DEFAULT 0 |
messages_written | INTEGER | NOT NULL DEFAULT 0 |
events_written | INTEGER | NOT NULL DEFAULT 0 |
threads_expanded | INTEGER | NOT NULL DEFAULT 0 |
error_message | TEXT | NULL |
operating_timeline_events
Defined in: 119_client_operating_timeline.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
event_key | TEXT | NOT NULL UNIQUE |
client_registry_id | INTEGER | NULL REFERENCES public.client_registry(workspace_id) ON DELETE SET NULL |
workspace_name | TEXT | NULL |
client_display_name | TEXT | NOT NULL |
brain_client_note | TEXT | NULL |
brain_operations_note | TEXT | NULL |
event_type | TEXT | NOT NULL |
event_status | TEXT | NOT NULL DEFAULT 'candidate' |
occurred_at | TIMESTAMPTZ | NULL |
occurred_date | DATE | NULL |
date_precision | TEXT | NOT NULL DEFAULT 'unknown' |
discovered_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
evidence_categories | TEXT[] | NOT NULL DEFAULT ARRAY[]::TEXT[] |
source_refs | JSONB | NOT NULL DEFAULT '[]'::jsonb |
source_quote | TEXT | NULL |
quote_safety_status | TEXT | NOT NULL DEFAULT 'not_requested' |
summary | TEXT | NOT NULL |
details | TEXT | NULL |
operating_domain | TEXT | NULL |
process_ref | TEXT | NULL |
brain_target_anchor | TEXT | NULL |
confidence | TEXT | NOT NULL |
risk_level | TEXT | NOT NULL DEFAULT 'medium' |
requested_change | JSONB | NOT NULL DEFAULT '{}'::jsonb |
proposed_state_update | JSONB | NOT NULL DEFAULT '{}'::jsonb |
implementation_status | TEXT | NOT NULL DEFAULT 'not_applicable' |
implementation_checked_at | TIMESTAMPTZ | NULL |
reviewed_by | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
reviewed_at | TIMESTAMPTZ | NULL |
brain_exported_at | TIMESTAMPTZ | NULL |
brain_export_run_id | UUID | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_timeline_event_links
Defined in: 119_client_operating_timeline.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
from_event_id | UUID | NOT NULL REFERENCES public.operating_timeline_events(id) ON DELETE CASCADE |
to_event_id | UUID | NOT NULL REFERENCES public.operating_timeline_events(id) ON DELETE CASCADE |
link_type | TEXT | NOT NULL |
confidence | TEXT | NOT NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_timeline_export_runs
Defined in: 119_client_operating_timeline.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
export_type | TEXT | NOT NULL |
status | TEXT | NOT NULL DEFAULT 'running' |
started_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
finished_at | TIMESTAMPTZ | NULL |
events_seen | INTEGER | NOT NULL DEFAULT 0 |
events_exported | INTEGER | NOT NULL DEFAULT 0 |
events_skipped | INTEGER | NOT NULL DEFAULT 0 |
target_path | TEXT | NULL |
metadata | JSONB | NOT NULL DEFAULT '{}'::jsonb |
error_message | TEXT | NULL |
slack_channel_policies
Defined in: 119_slack_operating_intake_phase_c_autonomy.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
team_id | TEXT | NOT NULL |
channel_id | TEXT | NULL |
name_pattern | TEXT | NULL |
policy | TEXT | NOT NULL |
reason | TEXT | NULL |
priority | INTEGER | NOT NULL DEFAULT 100 |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
slack_channel_coverage_events
Defined in: 119_slack_operating_intake_phase_c_autonomy.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
team_id | TEXT | NOT NULL |
channel_id | TEXT | NULL |
channel_name | TEXT | NULL |
event_type | TEXT | NOT NULL |
status | TEXT | NOT NULL |
reason | TEXT | NULL |
metadata | JSONB | NOT NULL DEFAULT '{}'::jsonb |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_intake_items
Defined in: 119_slack_operating_intake_phase_c_autonomy.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
source_system | TEXT | NOT NULL DEFAULT 'slack' |
team_id | TEXT | NOT NULL |
channel_id | TEXT | NOT NULL |
thread_ts | TEXT | NOT NULL |
message_ts | TEXT | NULL |
source_permalink | TEXT | NULL |
source_date | DATE | NULL |
channel_name | TEXT | NULL |
visibility | TEXT | NULL |
event_type | TEXT | NOT NULL |
routing_outcomes | TEXT[] | NOT NULL DEFAULT '{}' |
operating_domain | TEXT | NULL |
client_id | INTEGER | NULL REFERENCES public.client_registry(workspace_id) ON DELETE SET NULL |
client_name | TEXT | NULL |
related_brain_links | TEXT[] | NOT NULL DEFAULT '{}' |
backend_mapping | JSONB | NOT NULL DEFAULT '{}'::jsonb |
summary | TEXT | NOT NULL |
evidence_pointer | TEXT | NOT NULL |
confidence | TEXT | NOT NULL DEFAULT 'medium' |
review_status | TEXT | NOT NULL DEFAULT 'needs_review' |
safety_flags | TEXT[] | NOT NULL DEFAULT '{}' |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
brain_writeback_queue
Defined in: 119_slack_operating_intake_phase_c_autonomy.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
source_item_id | UUID | NULL REFERENCES public.operating_intake_items(id) ON DELETE SET NULL |
target_vault | TEXT | NOT NULL DEFAULT 'MaverickBrain' |
target_note_path | TEXT | NOT NULL |
target_section | TEXT | NOT NULL |
append_markdown | TEXT | NOT NULL |
writeback_status | TEXT | NOT NULL DEFAULT 'pending' |
safety_checked | BOOLEAN | NOT NULL DEFAULT false |
error_message | TEXT | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
client_onboardings
*v2 pipeline: client-level onboarding record. Each row aggregates 1-3 *
Defined in: 120_infra_order_pipeline_v2.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
client_workspace_name | TEXT | NOT NULL |
client_display_name | TEXT | NOT NULL |
stage | TEXT | NOT NULL DEFAULT 'in_progress' |
entry_type | TEXT | NOT NULL DEFAULT 'new_client' |
lead_target | INTEGER | NOT NULL, -- 100, 200, 300, 400, 500 or custom-supplied |
sizing_tier | TEXT | NOT NULL -- 'standard_100' | 'standard_200' | ... | 'custom' |
custom_google_count | INTEGER, | -- populated only when sizing_tier = 'custom' |
custom_m365_count | INTEGER | |
custom_azure_count | INTEGER | |
base_domain | TEXT | NOT NULL |
sending_name | TEXT | |
launch_date | DATE, | -- Tommy's target launch date, informational |
target_workspace_name | TEXT | |
target_bison_workspace_id | INTEGER | |
form_payload | JSONB | NOT NULL DEFAULT '{}'::jsonb |
started_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
fulfilled_at | TIMESTAMPTZ | |
warming_started_at | TIMESTAMPTZ, | -- when the LAST sub-order was ingested |
ready_to_launch_at | TIMESTAMPTZ | |
launched_at | TIMESTAMPTZ | |
active_at | TIMESTAMPTZ | |
cancelled_at | TIMESTAMPTZ | |
slack_channel_id | TEXT | |
slack_thread_ts | TEXT | |
created_by | TEXT, | -- user id or email |
notes | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
onboarding_steps
*Per-new-client 8-step provisioning checklist with 12h SLA. Verifiers *
Defined in: 120_infra_order_pipeline_v2.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
client_onboarding_id | INTEGER | NOT NULL |
step_key | TEXT | NOT NULL, -- 'client_record' | 'bison_workspace' | ... |
title | TEXT | NOT NULL |
owner_role | TEXT | NOT NULL -- 'ENG' | 'INFRA' | 'DATA' | 'CS' | 'FINANCE' |
status | TEXT | NOT NULL DEFAULT 'pending' |
due_at | TIMESTAMPTZ | NOT NULL, -- created_at + 12h SLA |
verified_at | TIMESTAMPTZ | |
verify_detail | TEXT | |
last_escalated_at | TIMESTAMPTZ, | -- Slack escalation dedupe (6h window) |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
email_verification_second_pass_queue
Defined in: 121_email_verification_second_pass_queue.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
raw_contact_id | BIGINT | NOT NULL REFERENCES public.raw_contacts(id) ON DELETE CASCADE |
workspace_name | TEXT | NOT NULL |
month | TEXT | NOT NULL |
email | TEXT | NOT NULL |
source_provider | TEXT | NOT NULL |
source_reason | TEXT | NOT NULL |
source_raw | JSONB | NOT NULL DEFAULT '{}'::jsonb |
queue_status | TEXT | NOT NULL DEFAULT 'pending' |
second_provider | TEXT | |
second_verdict | TEXT | |
second_raw | JSONB | |
exported_at | TIMESTAMPTZ | |
checked_at | TIMESTAMPTZ | |
promoted_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
second_verdict | IS | NULL OR second_verdict IN ( |
operating_entities
Lightweight operating entity registry for indexing evidence to clients, prospects, people, vendors, products, and operating domains.
Defined in: 121_operating_indexing_engine.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
entity_type | TEXT | NOT NULL |
canonical_name | TEXT | NOT NULL |
normalized_key | TEXT | NOT NULL |
canonical_ref | JSONB | NOT NULL DEFAULT '{}'::jsonb |
first_seen_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
last_seen_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_entity_matches
Entity resolver outputs and human-reviewed corrections keyed by adapter source refs.
Defined in: 121_operating_indexing_engine.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
source_system | TEXT | NOT NULL |
source_ref_key | TEXT | NOT NULL |
source_ref | JSONB | NOT NULL DEFAULT '{}'::jsonb |
source_event_id | UUID | NULL REFERENCES public.operating_source_events(id) ON DELETE CASCADE |
thread_id | UUID | NULL REFERENCES public.operating_threads(id) ON DELETE CASCADE |
entity_id | UUID | NOT NULL REFERENCES public.operating_entities(id) ON DELETE CASCADE |
entity_type | TEXT | NOT NULL |
match_confidence | NUMERIC | NOT NULL |
confidence_band | TEXT | NOT NULL |
match_reason | TEXT | NOT NULL |
is_primary | BOOLEAN | NOT NULL DEFAULT false |
reviewed_by | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
reviewed_at | TIMESTAMPTZ | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_intake_classifications
Source-agnostic operating classifications produced from IndexedInput.
Defined in: 121_operating_indexing_engine.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
source_system | TEXT | NOT NULL |
source_ref_key | TEXT | NOT NULL |
source_ref | JSONB | NOT NULL DEFAULT '{}'::jsonb |
source_event_id | UUID | NULL REFERENCES public.operating_source_events(id) ON DELETE CASCADE |
thread_id | UUID | NULL REFERENCES public.operating_threads(id) ON DELETE CASCADE |
raw_pointer | TEXT | NULL |
outcome | TEXT | NOT NULL |
operating_domain | TEXT | NOT NULL |
summary | TEXT | NOT NULL |
extracted_facts | JSONB | NOT NULL DEFAULT '{}'::jsonb |
recommended_next_action | TEXT | NULL |
owner_user_id | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
tommy_required | BOOLEAN | NOT NULL DEFAULT false |
urgency | TEXT | NOT NULL DEFAULT 'normal' |
confidence | NUMERIC | NOT NULL |
confidence_band | TEXT | NOT NULL |
confidence_reason | TEXT | NOT NULL |
high_risk | BOOLEAN | NOT NULL DEFAULT false |
model_used | TEXT | NULL |
prompt_version | TEXT | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_intake_review_items
Human review queue for classifications that need approval, routing, dismissal, or writeback.
Defined in: 121_operating_indexing_engine.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
classification_id | UUID | NOT NULL REFERENCES public.operating_intake_classifications(id) ON DELETE CASCADE |
source_system | TEXT | NOT NULL |
source_ref_key | TEXT | NOT NULL |
source_ref | JSONB | NOT NULL DEFAULT '{}'::jsonb |
review_queue | TEXT | NOT NULL |
title | TEXT | NOT NULL |
summary | TEXT | NOT NULL |
brain_safe_summary | TEXT | NULL |
matched_entity_id | UUID | NULL REFERENCES public.operating_entities(id) ON DELETE SET NULL |
client_workspace_name | TEXT | NULL |
prospect_entity_id | UUID | NULL REFERENCES public.operating_entities(id) ON DELETE SET NULL |
suggested_owner_user_id | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
suggested_writeback | JSONB | NOT NULL DEFAULT '{}'::jsonb |
evidence_url | TEXT | NULL |
status | TEXT | NOT NULL DEFAULT 'open' |
reviewed_by | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
reviewed_at | TIMESTAMPTZ | NULL |
review_notes | TEXT | NULL |
manual_approval_confirmed | BOOLEAN | NOT NULL DEFAULT false |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_intake_writebacks
Controlled writeback audit trail for Platform, MaverickBrain, Email Bison, and QuickBooks actions.
Defined in: 121_operating_indexing_engine.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
review_item_id | UUID | NOT NULL REFERENCES public.operating_intake_review_items(id) ON DELETE CASCADE |
writeback_type | TEXT | NOT NULL |
target_system | TEXT | NOT NULL |
target_ref | JSONB | NOT NULL DEFAULT '{}'::jsonb |
payload | JSONB | NOT NULL DEFAULT '{}'::jsonb |
status | TEXT | NOT NULL DEFAULT 'pending' |
requested_by | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
completed_at | TIMESTAMPTZ | NULL |
error_message | TEXT | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_digest_runs
Brain-safe digest output containing reviewed summaries only.
Defined in: 121_operating_indexing_engine.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
digest_type | TEXT | NOT NULL |
period_start | TIMESTAMPTZ | NOT NULL |
period_end | TIMESTAMPTZ | NOT NULL |
source_systems | TEXT[] | NOT NULL DEFAULT '{}'::text[] |
summary_md | TEXT | NOT NULL |
item_count | INTEGER | NOT NULL DEFAULT 0 |
generated_by | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_entity_aliases
Defined in: 122_operating_knowledge_promotion.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
entity_id | UUID | NULL REFERENCES public.operating_entities(id) ON DELETE CASCADE |
entity_type | TEXT | NOT NULL |
alias | TEXT | NOT NULL |
normalized_alias | TEXT | NOT NULL |
alias_type | TEXT | NOT NULL |
source_system | TEXT | NOT NULL DEFAULT 'manual' |
source_ref | JSONB | NOT NULL DEFAULT '{}'::jsonb |
confidence | NUMERIC | NOT NULL DEFAULT 0.5 |
status | TEXT | NOT NULL DEFAULT 'generated' |
created_by | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
reviewed_by | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
reviewed_at | TIMESTAMPTZ | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_process_taxonomy
Defined in: 122_operating_knowledge_promotion.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
process_key | TEXT | NOT NULL UNIQUE |
display_name | TEXT | NOT NULL |
department | TEXT | NOT NULL |
brain_note | TEXT | NULL |
canonical_destination | TEXT | NOT NULL |
owner_role | TEXT | NULL |
risk_level_default | TEXT | NOT NULL DEFAULT 'normal' |
active | BOOLEAN | NOT NULL DEFAULT true |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_promotion_runs
Defined in: 122_operating_knowledge_promotion.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
run_type | TEXT | NOT NULL |
source_systems | TEXT[] | NOT NULL DEFAULT '{}'::text[] |
mode | TEXT | NOT NULL |
period_start | TIMESTAMPTZ | NULL |
period_end | TIMESTAMPTZ | NULL |
filters | JSONB | NOT NULL DEFAULT '{}'::jsonb |
started_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
finished_at | TIMESTAMPTZ | NULL |
status | TEXT | NOT NULL DEFAULT 'running' |
threads_seen | INTEGER | NOT NULL DEFAULT 0 |
events_created | INTEGER | NOT NULL DEFAULT 0 |
events_linked | INTEGER | NOT NULL DEFAULT 0 |
patch_candidates_created | INTEGER | NOT NULL DEFAULT 0 |
error_message | TEXT | NULL |
operating_brain_patch_candidates
Defined in: 122_operating_knowledge_promotion.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
promotion_run_id | UUID | NULL REFERENCES public.operating_promotion_runs(id) ON DELETE SET NULL |
target_note_path | TEXT | NOT NULL |
target_anchor | TEXT | NOT NULL |
patch_type | TEXT | NOT NULL |
title | TEXT | NOT NULL |
summary | TEXT | NOT NULL |
patch_md | TEXT | NOT NULL |
patch_hash | TEXT | NOT NULL |
source_event_ids | UUID[] | NOT NULL DEFAULT '{}'::uuid[] |
timeline_event_ids | UUID[] | NOT NULL DEFAULT '{}'::uuid[] |
entity_ids | UUID[] | NOT NULL DEFAULT '{}'::uuid[] |
process_key | TEXT | NOT NULL DEFAULT '' |
risk_level | TEXT | NOT NULL DEFAULT 'normal' |
confidence | NUMERIC | NOT NULL DEFAULT 0.5 |
status | TEXT | NOT NULL DEFAULT 'generated' |
reviewed_by | UUID | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
reviewed_at | TIMESTAMPTZ | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_backfill_jobs
Checkpointed operating-intake historical backfill jobs. enabled=false is the kill switch; the beat runner no-ops without an enabled job.
Defined in: 128_operating_backfill_controller.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
job_key | TEXT | NOT NULL UNIQUE |
source_system | TEXT | NOT NULL |
status | TEXT | NOT NULL DEFAULT 'pending' |
enabled | BOOLEAN | NOT NULL DEFAULT FALSE |
chunk_size | INTEGER | NOT NULL DEFAULT 400 |
tick_minutes | INTEGER | NOT NULL DEFAULT 10 |
refs_total | INTEGER | NOT NULL DEFAULT 0 |
refs_done | INTEGER | NOT NULL DEFAULT 0 |
refs_failed | INTEGER | NOT NULL DEFAULT 0 |
last_claimed_at | TIMESTAMPTZ | NULL |
last_error | TEXT | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
operating_backfill_items
Per-thread work list for operating-intake historical backfill. source_ref_key matches IndexedInput.source_ref_key; excluded rows are policy-skipped machine channels (flip to pending to include later).
Defined in: 128_operating_backfill_controller.sql
| Column | Type | Constraints |
|---|---|---|
source_ref_key | TEXT | PRIMARY KEY |
job_id | UUID | NOT NULL REFERENCES public.operating_backfill_jobs(id) ON DELETE CASCADE |
payload | JSONB | NOT NULL DEFAULT '{}'::jsonb |
status | TEXT | NOT NULL DEFAULT 'pending' |
attempts | INTEGER | NOT NULL DEFAULT 0 |
last_error | TEXT | NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
stat_pollution_backup_2026_07
Defined in: 129_purge_cross_workspace_stat_pollution.sql
| Column | Type | Constraints |
|---|---|---|
id | bigint | GENERATED ALWAYS AS IDENTITY PRIMARY KEY |
backed_up_at | timestamptz | NOT NULL DEFAULT now() |
source_table | text | NOT NULL |
pollution_class | text | NOT NULL |
row_data | jsonb | NOT NULL |
audit_rules
Defined in: 131_daily_audit_engine.sql
| Column | Type | Constraints |
|---|---|---|
check_key | TEXT | PRIMARY KEY |
enabled | BOOLEAN | NOT NULL DEFAULT TRUE |
severity | TEXT | NOT NULL DEFAULT 'warn' |
owner_role | TEXT | NOT NULL DEFAULT 'tommy' |
params | JSONB | NOT NULL DEFAULT '{}'::jsonb |
notes | TEXT | |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
audit_findings
Defined in: 131_daily_audit_engine.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
check_key | TEXT | NOT NULL REFERENCES audit_rules(check_key) |
severity | TEXT | NOT NULL |
owner_role | TEXT | NOT NULL |
title | TEXT | NOT NULL |
evidence | JSONB | NOT NULL DEFAULT '{}'::jsonb |
status | TEXT | NOT NULL DEFAULT 'open' |
first_seen_date | DATE | NOT NULL |
last_seen_date | DATE | NOT NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
resolved_at | TIMESTAMPTZ |
operating_timeline_summary_repair_backup
Defined in: 133_operating_timeline_summary_repair_backup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
event_id | UUID | NOT NULL REFERENCES operating_timeline_events(id) ON DELETE CASCADE |
old_summary | TEXT | |
old_event_type | TEXT | |
repair_run_id | UUID | |
backed_up_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
auto_forward_config
Defined in: 134_auto_forward_dropped_producers.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL UNIQUE |
enabled | BOOLEAN | NOT NULL DEFAULT FALSE |
producer_emails | JSONB | NOT NULL DEFAULT '[]' |
max_forwards_per_lead_per_day | INTEGER | NOT NULL DEFAULT 5 |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
auto_forward_log
Defined in: 134_auto_forward_dropped_producers.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_reply_id | UUID | REFERENCES lead_replies(id) ON DELETE CASCADE |
bison_reply_numeric_id | INTEGER | NOT NULL |
lead_email | TEXT | |
status | TEXT | NOT NULL DEFAULT 'processing' |
skipped_reason | TEXT | |
forwarded_to | JSONB | NOT NULL DEFAULT '[]' |
sender_email_id | INTEGER | |
error_message | TEXT | |
processing_time_ms | INTEGER | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
infra_reconciliation_runs
Defined in: 141_orders_first_spine.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
ran_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
unlinked_warming_count | INTEGER | NOT NULL |
proposal_pending_count | INTEGER | NOT NULL |
stamped_this_run | INTEGER | NOT NULL DEFAULT 0 |
proposals_created_this_run | INTEGER | NOT NULL DEFAULT 0 |
detail | JSONB | DEFAULT '{}'::jsonb |
diagnostics_runs
Defined in: 143_workspace_diagnostics.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
started_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
finished_at | TIMESTAMPTZ | |
status | TEXT | NOT NULL DEFAULT 'running' |
workspaces_scanned | INTEGER | NOT NULL DEFAULT 0 |
workspaces_errored | INTEGER | NOT NULL DEFAULT 0 |
findings_total | INTEGER | NOT NULL DEFAULT 0 |
findings_critical | INTEGER | NOT NULL DEFAULT 0 |
findings_warning | INTEGER | NOT NULL DEFAULT 0 |
findings_info | INTEGER | NOT NULL DEFAULT 0 |
error_detail | TEXT | |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
workspace_diagnostics_findings
Defined in: 143_workspace_diagnostics.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
run_id | BIGINT | NOT NULL REFERENCES diagnostics_runs(id) ON DELETE CASCADE |
workspace_name | TEXT | NOT NULL |
check_code | TEXT | NOT NULL |
severity | TEXT | NOT NULL CHECK (severity IN ('critical', 'warning', 'info')) |
bison_campaign_id | INTEGER | |
campaign_name | TEXT | |
summary | TEXT | NOT NULL |
detail | JSONB | NOT NULL DEFAULT '{}'::jsonb |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
bison_campaign_snapshots
Defined in: 143_workspace_diagnostics.sql
| Column | Type | Constraints |
|---|---|---|
snapshot_date | DATE | NOT NULL |
workspace_name | TEXT | NOT NULL |
bison_campaign_id | INTEGER | NOT NULL |
campaign | JSONB | NOT NULL |
senders | JSONB | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
client_announcements
*Admin-composed client announcements fanned out to Slack + portal + email *
Defined in: 151_client_announcements.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
title | TEXT | NOT NULL |
body_md | TEXT | NOT NULL |
announcement_type | TEXT | NOT NULL DEFAULT 'general' |
linked_resource_id | UUID | REFERENCES resources(id) ON DELETE SET NULL |
audience | TEXT | NOT NULL DEFAULT 'selected' |
target_workspaces | TEXT[] | NOT NULL DEFAULT '{}' |
channels | JSONB | NOT NULL DEFAULT '{"slack": true, "portal": true, "email": false}' |
status | TEXT | NOT NULL DEFAULT 'draft' |
scheduled_at | TIMESTAMPTZ | |
sent_at | TIMESTAMPTZ | |
created_by | UUID | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
announcement_type | IN | ('feature', 'infrastructure', 'launch', 'best_practice', 'general') |
status | IN | ('draft', 'scheduled', 'sending', 'sent', 'partial_failure') |
announcement_deliveries
*One row per (announcement, workspace, channel, recipient) attempt. The *
Defined in: 151_client_announcements.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
announcement_id | UUID | NOT NULL REFERENCES client_announcements(id) ON DELETE CASCADE |
workspace_name | TEXT | NOT NULL |
channel | TEXT | NOT NULL |
recipient | TEXT | NOT NULL DEFAULT '-' |
status | TEXT | NOT NULL DEFAULT 'sent' |
error | TEXT | |
sent_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
announcement_reads
Defined in: 151_client_announcements.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
announcement_id | UUID | NOT NULL REFERENCES client_announcements(id) ON DELETE CASCADE |
user_id | UUID | NOT NULL |
read_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
announcement_email_optouts
*Exceptions only. Recipient base = live user_workspace_access membership *
Defined in: 151_client_announcements.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
email | TEXT | NOT NULL |
disabled_by | UUID | |
disabled_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
announcement_extra_recipients
Defined in: 151_client_announcements.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
email | TEXT | NOT NULL |
added_by | UUID | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
order_send_activity
Defined in: 151_order_send_activity.sql
| Column | Type | Constraints |
|---|---|---|
order_id | INTEGER | NOT NULL |
snapshot_date | DATE | NOT NULL |
senders_sending | INTEGER | NOT NULL DEFAULT 0 |
total_sent | BIGINT | NOT NULL DEFAULT 0 |
infra_workspace_daily
Defined in: 153_infra_workspace_daily.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
snapshot_date | DATE | NOT NULL |
accounts_total | INTEGER | NOT NULL DEFAULT 0 |
accounts_connected | INTEGER | NOT NULL DEFAULT 0 |
accounts_warming | INTEGER | NOT NULL DEFAULT 0 |
accounts_sending | INTEGER | NOT NULL DEFAULT 0 |
sum_daily_limit | BIGINT | NOT NULL DEFAULT 0 |
avg_daily_limit | NUMERIC(8,2) | |
stale_count | INTEGER | NOT NULL DEFAULT 0 |
announcement_event_policies
*Per-event-type switchboard for the product event engine. mode=draft *
Defined in: 154_announcement_event_engine.sql
| Column | Type | Constraints |
|---|---|---|
event_type | TEXT | PRIMARY KEY |
enabled | BOOLEAN | NOT NULL DEFAULT TRUE |
mode | TEXT | NOT NULL DEFAULT 'draft' |
channels | JSONB | NOT NULL DEFAULT '{"slack": true, "portal": true, "email": false}' |
updated_by | UUID | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
sender_disconnect_state
Defined in: 154_disconnect_state.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
email_address | TEXT | NOT NULL |
bison_sender_email_id | BIGINT | |
bison_type | TEXT, | -- microsoft_oauth / google_workspace_oauth / ... |
triage_class | TEXT | NOT NULL DEFAULT 'investigate', -- oauth_reconnect | investigate |
first_disconnected_at | TIMESTAMPTZ | NOT NULL, -- webhook event ts when available, else first census sighting |
last_confirmed_at | TIMESTAMPTZ | NOT NULL, -- last census/probe that saw it disconnected |
detected_via | TEXT | NOT NULL DEFAULT 'census', -- 'webhook' | 'census' |
resolved_at | TIMESTAMPTZ, | -- NULL = still disconnected |
resolution | TEXT, | -- 'reconnected' | 'deleted' | NULL |
supplier | TEXT, | -- display resolution at insert time |
infrastructure_order_id | INTEGER, | -- denormed from email_accounts FK |
scope | TEXT | NOT NULL DEFAULT 'active', -- 'active' | 'inactive_client' | 'pool' | 'unknown' |
last_reported_date | DATE, | -- daily-CSV NEW-flag bookkeeping |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
announcement_pipeline_enrollment
*Workspaces enrolled in the automated product-event notification *
Defined in: 155_announcement_pipeline_enrollment.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | PRIMARY KEY |
enrolled_by | UUID | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
account_deletion_queue
Defined in: 156_account_deletion_queue.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
bison_sender_email_id | BIGINT | NOT NULL |
email_address | TEXT | |
workspace_name | TEXT | NOT NULL |
infrastructure_order_id | INTEGER | |
reason | TEXT | NOT NULL |
queued_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
queued_by | TEXT | NOT NULL |
status | TEXT | NOT NULL DEFAULT 'pending' |
resolved_at | TIMESTAMPTZ | |
resolved_by | TEXT | |
notes | TEXT |
burnt_cohorts
Defined in: 158_burnt_cohorts.sql
| Column | Type | Constraints |
|---|---|---|
id | SERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
root_domain | TEXT | NOT NULL |
provider_key | TEXT | |
reseller_slug | TEXT | |
scan_week | DATE | NOT NULL |
detected_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
detection_signals | JSONB | NOT NULL, -- {total_sent, total_replied, reply_rate, bounce_rate, ...} |
account_ids | BIGINT[] | NOT NULL, -- Bison sender ids at detection time |
account_count | INT | NOT NULL |
connected_at_detection | INT | NOT NULL |
lost_capacity_per_day | INT | NOT NULL, -- SUM(provider_cap) across connected accts |
status | TEXT | NOT NULL DEFAULT 'detected' |
confirmed_at | TIMESTAMPTZ | |
confirmed_by | TEXT | |
detached_at | TIMESTAMPTZ | |
delete_after | TIMESTAMPTZ, | -- default detached_at + 14d, editable |
sent_to_deletion_at | TIMESTAMPTZ | |
resolved_at | TIMESTAMPTZ | |
replacement_order_id | INTEGER | |
replacement_declined_at | TIMESTAMPTZ | |
reseller_cancel_requested_at | TIMESTAMPTZ | |
reseller_cancelled_at | TIMESTAMPTZ | |
healthy_split_campaigns | JSONB, | -- [{original_cid, clone_cid, healthy_count, burnt_count}] |
dismissed_at | TIMESTAMPTZ | |
dismissed_by | TEXT | |
notes | TEXT | |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
Indexes
| Index | Table | Columns |
|---|---|---|
idx_user_workspace_access_user_id | user_workspace_access | user_id |
idx_user_workspace_access_workspace | user_workspace_access | workspace_name |
idx_user_workspace_access_role | user_workspace_access | role |
idx_client_registry_workspace_name | client_registry | workspace_name |
idx_client_registry_active | client_registry | is_active |
idx_client_registry_billing_type | client_registry | billing_type |
idx_client_settings_workspace | client_settings | workspace_name |
idx_client_pricing_workspace | client_pricing | workspace_name |
idx_client_costs_workspace_month | client_costs | workspace_name, month |
idx_revenue_snapshots_workspace_month | monthly_revenue_snapshots | workspace_name, month |
idx_client_zipcodes_workspace | client_zipcodes | workspace_name |
idx_client_zipcodes_state | client_zipcodes | state |
idx_client_zipcodes_month | client_zipcodes | month |
idx_client_zipcodes_zip | client_zipcodes | zip_code |
idx_raw_contacts_upload_batch | raw_contacts | upload_batch_id |
idx_raw_contacts_workspace_month | raw_contacts | workspace_name, month |
idx_raw_contacts_status | raw_contacts | processing_status |
idx_raw_contacts_purchase_date | raw_contacts | parsed_purchase_date |
idx_raw_contacts_zip | raw_contacts | property_zip |
idx_raw_contacts_scraping_job | raw_contacts | scraping_job_id |
idx_verified_contacts_workspace_month | verified_contacts | workspace_name, month |
idx_verified_contacts_week_bucket | verified_contacts | week_bucket |
idx_verified_contacts_renewal_dates | verified_contacts | renewal_start_date, renewal_end_date |
idx_verified_contacts_upload_status | verified_contacts | is_uploaded, week_bucket |
idx_verified_contacts_debounce_status | verified_contacts | debounce_status |
idx_verified_contacts_hnw | verified_contacts | is_high_net_worth |
idx_weekly_batches_workspace_month | weekly_batches | workspace_name, month |
idx_weekly_batches_schedule | weekly_batches | scheduled_upload_date, bison_upload_status |
idx_weekly_batches_status | weekly_batches | bison_upload_status |
idx_upload_audit_batch | upload_audit_log | batch_id |
idx_upload_audit_workspace_month | upload_audit_log | workspace_name, month |
idx_upload_audit_action | upload_audit_log | action |
idx_upload_audit_status | upload_audit_log | status |
idx_upload_audit_date | upload_audit_log | performed_at DESC |
idx_debounce_usage_month | debounce_usage | month |
idx_debounce_usage_workspace | debounce_usage | workspace_name |
idx_debounce_usage_date | debounce_usage | verified_at DESC |
idx_scraping_jobs_workspace | scraping_jobs | workspace_name |
idx_scraping_jobs_status | scraping_jobs | status |
idx_scraping_jobs_created | scraping_jobs | created_at DESC |
idx_scraping_jobs_celery_task | scraping_jobs | celery_task_id |
idx_scraping_job_logs_job_id | scraping_job_logs | job_id |
idx_scraping_job_logs_logged_at | scraping_job_logs | logged_at DESC |
idx_agent_runs_workflow | agent_runs | workflow |
idx_agent_runs_client_id | agent_runs | client_id |
idx_agent_runs_status | agent_runs | status |
idx_agent_runs_started_at | agent_runs | started_at DESC |
idx_agent_errors_run_id | agent_errors | run_id |
idx_agent_errors_step | agent_errors | step |
idx_agent_errors_type | agent_errors | error_type |
idx_agent_errors_resolved | agent_errors | resolved |
idx_site_credentials_site | site_credentials | site |
idx_site_credentials_username | site_credentials | username |
idx_client_leads_workspace | client_leads | workspace_name |
idx_client_leads_pipeline | client_leads | pipeline_stage |
idx_client_leads_date | client_leads | date_received DESC |
idx_client_leads_airtable | client_leads | airtable_id |
idx_client_leads_updated | client_leads | updated_at DESC |
idx_client_leads_email | client_leads | lead_email |
idx_client_leads_interested | client_leads | interested |
idx_client_leads_deleted | client_leads | deleted_at |
idx_email_accounts_workspace | email_accounts | workspace_name |
idx_email_accounts_status | email_accounts | status |
idx_email_accounts_health | email_accounts | health_score |
idx_email_account_metadata_account | email_account_metadata | email_account_id |
idx_email_account_metadata_date | email_account_metadata | metric_date DESC |
idx_user_profiles_email | user_profiles | email |
idx_user_profiles_default_workspace | user_profiles | default_workspace_name |
idx_user_profiles_is_active | user_profiles | is_active |
idx_user_workspace_access_active | user_workspace_access | user_id, workspace_name |
idx_raw_contacts_workspace_status | raw_contacts | workspace_name, processing_status |
idx_raw_contacts_workspace_month | raw_contacts | workspace_name, month |
idx_raw_contacts_batch | raw_contacts | upload_batch_id |
idx_raw_contacts_job | raw_contacts | scraping_job_id |
idx_raw_contacts_email | raw_contacts | email |
idx_raw_contacts_workspace_status_month | raw_contacts | workspace_name, processing_status, month |
idx_raw_contacts_email_domain | raw_contacts | email_domain |
idx_raw_contacts_purchase_year | raw_contacts | purchase_year |
idx_raw_contacts_age | raw_contacts | age_years |
idx_raw_contacts_dnc_landline | raw_contacts | dnc_landline |
idx_raw_contacts_dnc_cell | raw_contacts | dnc_cell |
idx_raw_contacts_dob | raw_contacts | date_of_birth |
idx_raw_contacts_purchase_amount | raw_contacts | purchase_amount |
idx_filter_rules_workspace_active | client_filter_rules | workspace_name, is_active, priority |
idx_filter_rules_field | client_filter_rules | field_name |
idx_verified_contacts_head_of_household | verified_contacts | is_head_of_household |
idx_verified_contacts_email_domain | verified_contacts | email_domain |
idx_verified_contacts_engagement | verified_contacts | last_engagement_at DESC |
idx_verified_contacts_campaign_targeting | verified_contacts | workspace_name, is_uploaded, is_head_of_household, email_domain |
idx_client_registry_email_bison_workspace | client_registry | email_bison_workspace_id |
idx_weekly_batches_bison_campaign_id | weekly_batches | bison_campaign_id |
idx_site_credentials_vault_secret_id | site_credentials | vault_secret_id |
idx_credential_audit_credential_id | credential_audit_log | credential_id |
idx_credential_audit_performed_by | credential_audit_log | performed_by |
idx_credential_audit_action | credential_audit_log | action |
idx_credential_audit_created_at | credential_audit_log | created_at DESC |
idx_scraping_job_batches_job_id | scraping_job_batches | job_id |
idx_scraping_job_batches_status | scraping_job_batches | status |
idx_scraping_job_batches_workspace | scraping_job_batches | workspace_name |
idx_scraping_job_batches_state_month | scraping_job_batches | state, month |
idx_scraping_job_batches_credential | scraping_job_batches | credential_id |
idx_scraping_job_batches_celery_task | scraping_job_batches | celery_task_id |
idx_scraping_job_batches_active | scraping_job_batches | workspace_name, status, created_at DESC |
idx_campaign_metrics_batch_id | campaign_metrics | batch_id |
idx_campaign_metrics_campaign_id | campaign_metrics | email_bison_campaign_id |
idx_campaign_metrics_synced_at | campaign_metrics | synced_at DESC |
idx_raw_contacts_workspace_month_email | raw_contacts | workspace_name, month, email |
idx_raw_contacts_workspace_month_address | raw_contacts | workspace_name, month, property_address |
idx_debounce_bulk_workspace | debounce_bulk_jobs | workspace_name |
idx_debounce_bulk_status | debounce_bulk_jobs | status |
idx_debounce_bulk_list_id | debounce_bulk_jobs | debounce_list_id |
idx_scraping_jobs_credential_username | scraping_jobs | credential_username |
idx_filtering_tasks_workspace | filtering_tasks | workspace_name |
idx_filtering_tasks_status | filtering_tasks | status |
idx_filtering_tasks_created | filtering_tasks | created_at DESC |
idx_verification_tasks_workspace | verification_tasks | workspace_name |
idx_verification_tasks_status | verification_tasks | status |
idx_verification_tasks_created | verification_tasks | created_at DESC |
idx_verification_tasks_bulk_job | verification_tasks | bulk_job_id |
idx_pipeline_runs_workspace | pipeline_runs | workspace_name |
idx_pipeline_runs_status | pipeline_runs | status |
idx_pipeline_runs_run_id | pipeline_runs | run_id |
idx_pipeline_runs_created_at | pipeline_runs | created_at DESC |
idx_verified_contacts_upload_status | verified_contacts | upload_status |
idx_email_accounts_bison_id | email_accounts | bison_sender_email_id |
idx_email_accounts_workspace_bison_status | email_accounts | workspace_name, bison_status |
idx_email_accounts_warmup_score | email_accounts | warmup_score |
idx_email_accounts_sent_today_date | email_accounts | emails_sent_today_date |
idx_campaign_metrics_status | campaign_metrics | campaign_status |
idx_campaign_metrics_workspace | campaign_metrics | workspace_name |
idx_campaign_metrics_completion | campaign_metrics | completion_percentage DESC |
idx_campaign_metrics_workspace_status | campaign_metrics | workspace_name, campaign_status |
idx_client_leads_bison_id_int | client_leads | bison_lead_id_int |
idx_client_leads_campaign_status | client_leads | workspace_name, lead_campaign_status |
idx_client_leads_bison_campaign | client_leads | bison_campaign_id |
idx_client_leads_verification_status | client_leads | bison_verification_status |
idx_client_leads_synced_at | client_leads | bison_lead_synced_at DESC |
idx_client_leads_automated_reply | client_leads | is_automated_reply |
idx_client_targets_workspace | client_targets | workspace_name |
idx_client_targets_month | client_targets | month DESC |
idx_client_targets_workspace_month | client_targets | workspace_name, month |
idx_client_targets_contacts_progress | client_targets | contacts_progress DESC |
idx_client_targets_leads_progress | client_targets | leads_progress DESC |
idx_crm_delivery_workspace | crm_delivery_log | workspace_name |
idx_crm_delivery_lead_email | crm_delivery_log | lead_email |
idx_crm_delivery_success | crm_delivery_log | success |
idx_crm_delivery_created | crm_delivery_log | created_at |
idx_crm_delivery_pending_retry | crm_delivery_log | next_retry_at |
idx_slack_notifications_unique | slack_notifications_sent | reply_id, notification_type |
idx_slack_notifications_workspace | slack_notifications_sent | workspace_name |
idx_lead_replies_workspace | lead_replies | workspace_name |
idx_lead_replies_email | lead_replies | lead_email |
idx_lead_replies_interested | lead_replies | is_interested |
idx_lead_replies_date | lead_replies | reply_date DESC |
idx_lead_replies_live_enabled | lead_replies | live_replies_enabled, reply_date DESC |
idx_webhook_log_workspace | webhook_delivery_log | workspace_name |
idx_webhook_log_event | webhook_delivery_log | event_type |
idx_webhook_log_created | webhook_delivery_log | created_at DESC |
idx_webhook_log_failures | webhook_delivery_log | success |
idx_webhook_health_workspace | webhook_health | workspace_name |
idx_webhook_health_unhealthy | webhook_health | is_healthy |
idx_raw_contacts_source_type | raw_contacts | source_type |
idx_raw_contacts_master_vendor | raw_contacts | master_vendor_id |
idx_raw_contacts_master_dedup | raw_contacts | workspace_name, month, master_vendor_id |
idx_raw_contacts_home_value_code | raw_contacts | home_value_code |
idx_campaign_crm_routing_campaign_id | campaign_crm_routing | campaign_id |
idx_campaign_crm_routing_workspace | campaign_crm_routing | workspace_name |
idx_campaign_crm_routing_active | campaign_crm_routing | is_active |
idx_scraping_jobs_csv_processing_status | scraping_jobs | csv_processing_status |
idx_tasks_status | tasks | status |
idx_tasks_assignee_id | tasks | assignee_id |
idx_tasks_priority | tasks | priority |
idx_tasks_due_date | tasks | due_date |
idx_tasks_created_by | tasks | created_by |
idx_tasks_created_at | tasks | created_at DESC |
idx_lead_replies_response_time | lead_replies | workspace_name, our_reply_sent_at |
idx_auto_reply_log_workspace | auto_reply_log | workspace_name, created_at DESC |
idx_auto_reply_log_rate_limit | auto_reply_log | workspace_name, sent_successfully, created_at |
idx_reply_templates_workspace | reply_templates | workspace_name |
idx_sent_replies_workspace | sent_replies | workspace_name, created_at DESC |
idx_sent_replies_bison_reply | sent_replies | bison_reply_id |
idx_sma_policies_workspace | sma_policies | workspace_name |
idx_client_metrics_workspace_date | client_metrics | workspace_name, metric_date DESC |
idx_client_metrics_unique | client_metrics | workspace_name, metric_date, metric_type |
idx_monthly_daily_revenue_month | monthly_daily_revenue_history | month_year, day |
idx_workspace_metrics_last_bounce_alert | workspace_metrics | workspace_name, last_bounce_alert_at |
idx_monthly_daily_revenue_unique | monthly_daily_revenue_history | month_year, day |
idx_client_leads_workspace_email | client_leads | workspace_name, lead_email |
idx_lead_replies_workspace_email_date | lead_replies | workspace_name, lead_email, reply_date DESC |
idx_wsc_type | workspace_stats_cache | cache_type |
idx_wsc_workspace | workspace_stats_cache | workspace_name |
idx_wsc_date_desc | workspace_stats_cache | stat_date DESC |
idx_wsc_type_ws | workspace_stats_cache | cache_type, workspace_name |
idx_raw_contacts_month | raw_contacts | month |
idx_verified_contacts_month | verified_contacts | month |
idx_pipeline_stats_cache_month | pipeline_stats_cache | month |
idx_wds_date | workspace_daily_stats | stat_date DESC |
idx_wds_ws_date | workspace_daily_stats | workspace_name, stat_date DESC |
idx_email_accounts_mx_checked | email_accounts | mx_checked_at |
idx_infra_orders_workspace | infrastructure_orders | workspace_name |
idx_infra_orders_stage | infrastructure_orders | stage |
idx_infra_orders_workspace_stage | infrastructure_orders | workspace_name, stage |
idx_order_events_order | infrastructure_order_events | order_id |
idx_onboarding_drafts_status | onboarding_drafts | status |
idx_onboarding_drafts_created_by | onboarding_drafts | created_by |
idx_agent_threads_user | agent_threads | user_id |
idx_agent_threads_updated | agent_threads | updated_at DESC |
idx_agent_messages_thread | agent_messages | thread_id, created_at |
idx_email_accounts_domain | email_accounts | domain |
idx_email_accounts_ws_domain | email_accounts | workspace_name, domain |
idx_task_events_status_created | task_events | status, created_at DESC |
idx_task_events_created | task_events | created_at |
idx_hof_nominations_category | hall_of_fame_nominations | category |
idx_hof_nominations_vote_count | hall_of_fame_nominations | vote_count DESC |
idx_hof_nominations_created | hall_of_fame_nominations | created_at DESC |
idx_hof_nominations_workspace | hall_of_fame_nominations | workspace_name |
idx_hof_votes_nomination | hall_of_fame_votes | nomination_id |
idx_hof_votes_user | hall_of_fame_votes | user_email |
idx_tasks_source_kind | tasks | (source->>'kind' |
idx_user_profiles_is_team_member | user_profiles | is_team_member |
idx_task_activity_task_id_created_at | task_activity | task_id, created_at DESC |
idx_task_activity_event_type | task_activity | event_type |
idx_lead_replies_intent | lead_replies | intent |
idx_ai_gen_log_workspace | ai_generation_log | workspace_name, created_at DESC |
idx_prompt_eval_workspace | prompt_eval_results | workspace_name, created_at DESC |
uq_crm_destinations_route | crm_destinations | workspace_name, crm_type, external_api_url, COALESCE(campaign_id, -1 |
idx_crm_destinations_workspace | crm_destinations | workspace_name |
idx_crm_destinations_campaign | crm_destinations | campaign_id |
idx_crm_delivery_log_idempotency | crm_delivery_log | bison_reply_id, destination_id |
idx_crm_delivery_log_parent | crm_delivery_log | parent_delivery_id |
idx_client_registry_v2_routing | client_registry | workspace_name |
idx_raw_contacts_workspace_month_email | raw_contacts | workspace_name, month |
idx_raw_contacts_workspace_master_vendor | raw_contacts | workspace_name |
idx_resources_category | resources | category |
idx_resources_type | resources | resource_type |
idx_resources_created_at | resources | created_at DESC |
idx_resource_requests_status_created | resource_requests | status, created_at DESC |
idx_resource_requests_requester | resource_requests | requester_user_id, created_at DESC |
idx_revenue_refunds_workspace_month | revenue_refunds | workspace_name, month |
idx_revenue_refunds_month | revenue_refunds | month |
uq_revenue_refunds_workspace_month_email | revenue_refunds | workspace_name, month, lead_email |
idx_revenue_referrals_workspace_month | revenue_referrals | workspace_name, month |
idx_revenue_referrals_month | revenue_referrals | month |
idx_task_timeline_task_id_created_at | task_timeline | task_id, created_at DESC |
idx_task_timeline_kind | task_timeline | kind |
idx_user_profiles_slack_user_id | user_profiles | slack_user_id |
idx_slack_event_dedup_processed_at | slack_event_dedup | processed_at |
CONCURRENTLY | verified_contacts | provider |
CONCURRENTLY | debounce_usage | provider |
idx_email_accounts_last_webhook_at | email_accounts | last_webhook_at DESC |
idx_audit_verticals_enabled | audit_verticals | enabled |
idx_audit_recommendation_rules_lookup | audit_recommendation_rules | loop_type, vertical_id |
idx_audit_sync_state_stage_status | audit_sync_state | stage, last_status, last_audited_at |
idx_audit_sync_state_workspace | audit_sync_state | workspace_name, vertical_id |
idx_audit_rank_by_subject_lower | audit_rank_by_subject | vertical_id, interested_rate_lower_pct DESC |
idx_audit_rank_by_pitch_lower | audit_rank_by_pitch | vertical_id, interested_rate_lower_pct DESC |
idx_audit_rank_by_parent_template_lower | audit_rank_by_parent_template | vertical_id, interested_rate_lower_pct DESC |
idx_audit_rank_by_master_template_lower | audit_rank_by_master_template | vertical_id, interested_rate_lower_pct DESC |
idx_audit_rank_by_step_position | audit_rank_by_step | vertical_id, step_position |
idx_audit_rank_by_sender_combo_lower | audit_rank_by_sender_combo | vertical_id, interested_per_send_lower_pct DESC |
idx_audit_rank_by_sender_domain_lower | audit_rank_by_sender_domain | vertical_id, interested_per_send_lower_pct DESC |
idx_audit_rank_by_sender_local_pattern_lower | audit_rank_by_sender_local_pattern | vertical_id, interested_per_send_lower_pct DESC |
uniq_audit_recommendations_active | audit_recommendations | workspace_name, loop_type, (evidence_payload->>'state_hash' |
idx_audit_recommendations_workspace_status | audit_recommendations | workspace_name, status, generated_at DESC |
idx_audit_recommendations_expires | audit_recommendations | expires_at |
uniq_audit_deployments_rec_source | audit_deployments | recommendation_id, signal_source |
idx_audit_deployments_deployed_at | audit_deployments | deployed_at |
idx_audit_outcomes_deployment | audit_outcomes | deployment_id, measured_at DESC |
idx_audit_outcomes_verdict | audit_outcomes | verdict, measured_at DESC |
idx_xpressdocs_backfill_jobs_status | xpressdocs_backfill_jobs | status |
idx_xpressdocs_backfill_jobs_credential_status | xpressdocs_backfill_jobs | credential_username, status |
idx_xpressdocs_backfill_jobs_month_year | xpressdocs_backfill_jobs | month_year |
idx_xpressdocs_backfill_jobs_state_month | xpressdocs_backfill_jobs | state, month_year |
idx_xpressdocs_backfill_jobs_scraping_job_id | xpressdocs_backfill_jobs | scraping_job_id |
idx_xpressdocs_backfill_jobs_needs_sync | xpressdocs_backfill_jobs | updated_at |
idx_audit_replies_campaign | audit_replies | workspace_name, campaign_id, received_at DESC |
idx_audit_replies_scheduled | audit_replies | workspace_name, scheduled_email_id |
idx_audit_replies_interested | audit_replies | workspace_name, is_interested |
idx_audit_origins_campaign_step | audit_origins | workspace_name, campaign_id, sequence_step_id |
idx_audit_origins_sender | audit_origins | workspace_name, sender_email_id |
idx_audit_origins_subject | audit_origins | email_subject |
idx_audit_step_stats_campaign_step | audit_step_stats | workspace_name, campaign_id, sequence_step_id |
idx_audit_step_stats_subject | audit_step_stats | email_subject |
idx_lead_replies_sender_date | lead_replies | sender_email, reply_date DESC |
idx_audit_senders_domain | audit_senders | workspace_name, domain |
idx_audit_senders_local_pattern | audit_senders | local_pattern |
idx_audit_senders_active | audit_senders | workspace_name, status |
idx_eads_email_date | email_account_daily_stats | email_address, stat_date DESC |
idx_eads_workspace_date | email_account_daily_stats | workspace_name, stat_date DESC |
idx_eads_date | email_account_daily_stats | stat_date DESC |
idx_eads_anomaly | email_account_daily_stats | stat_date DESC |
idx_audit_origins_outcome | audit_origins | workspace_name, outcome |
idx_audit_briefings_workspace_latest | audit_briefings | workspace_name, generated_at DESC |
idx_audit_briefings_vertical | audit_briefings | vertical_id, generated_at DESC |
idx_volume_tracking_date | workspace_volume_tracking | tracking_date DESC |
idx_client_registry_client_type_active | client_registry | client_type |
idx_billing_subs_workspace | billing_subscriptions | workspace_name |
idx_billing_subs_signature | billing_subscriptions | billable_units, rate |
idx_billing_subs_invoice_prefix | billing_subscriptions | invoice_prefix |
idx_billing_receipts_paid_at | billing_receipts | paid_at DESC |
idx_billing_receipts_invoice_prefix | billing_receipts | invoice_prefix |
idx_billing_receipts_match_confidence | billing_receipts | match_confidence |
idx_billing_receipts_matched_sub | billing_receipts | matched_subscription_id |
idx_billing_disputes_status | billing_disputes | status, opened_at DESC |
idx_billing_disputes_type | billing_disputes | dispute_type |
idx_billing_subs_variance_overbilled | billing_subscriptions | variance_units |
idx_raw_contacts_workspace_month_master_vendor | raw_contacts | workspace_name, month |
idx_audit_stage_runs_stage_started | audit_stage_runs | stage, started_at DESC |
idx_audit_stage_runs_workspace | audit_stage_runs | workspace_name, started_at DESC |
idx_webhook_log_received | webhook_delivery_log | ingested_at |
idx_ifp_auto_mark | interested_format_promotions | auto_mark |
idx_email_accounts_mx_checked_at | email_accounts | mx_checked_at |
idx_email_account_daily_stats_stat_date | email_account_daily_stats | stat_date |
idx_awp_vertical_pitch | audit_workspace_pitches | vertical_id, pitch_body_fingerprint |
idx_awp_ws_subject | audit_workspace_pitches | workspace_name, subject_norm |
idx_carrier_scrub_runs_workspace | carrier_scrub_runs | workspace_name |
idx_carrier_scrub_runs_status | carrier_scrub_runs | status |
uq_carrier_scrub_runs_active | carrier_scrub_runs | workspace_name, target_month |
uq_carrier_affiliations_identity | carrier_affiliations | carrier, last_name, first_name, property_zip |
idx_carrier_affiliations_zip | carrier_affiliations | property_zip |
idx_carrier_affiliations_carrier | carrier_affiliations | carrier |
idx_spam_block_events_pending | spam_block_events | workspace_name, detected_at |
idx_spam_block_events_workspace_time | spam_block_events | workspace_name, detected_at DESC |
idx_spam_block_events_domain_time | spam_block_events | sender_domain, detected_at DESC |
idx_operating_source_accounts_system_enabled | operating_source_accounts | source_system, ingest_enabled |
idx_operating_source_accounts_owner_user_id | operating_source_accounts | owner_user_id |
idx_operating_source_events_system_occurred_at | operating_source_events | source_system, occurred_at DESC |
idx_operating_source_events_status_ingested | operating_source_events | processing_status, ingested_at |
idx_operating_source_events_thread_key | operating_source_events | thread_key |
idx_operating_threads_last_activity_at | operating_threads | last_activity_at DESC |
idx_operating_threads_primary_client_workspace_name | operating_threads | primary_client_workspace_name |
idx_operating_threads_primary_entity_id | operating_threads | primary_entity_id |
idx_operating_thread_messages_thread_occurred_at | operating_thread_messages | thread_id, occurred_at |
idx_operating_thread_messages_source_event_id | operating_thread_messages | source_event_id |
idx_operating_source_artifacts_artifact_kind | operating_source_artifacts | artifact_kind |
idx_operating_source_artifacts_source_event_id | operating_source_artifacts | source_event_id |
idx_operating_intake_runs_system_started | operating_intake_runs | source_system, started_at DESC |
idx_operating_intake_runs_account_started | operating_intake_runs | source_account_id, started_at DESC |
idx_slack_conversations_ingest_enabled | slack_conversations | ingest_enabled |
idx_slack_conversations_client_id | slack_conversations | client_id |
idx_slack_users_user_profile_id | slack_users | user_profile_id |
idx_slack_events_raw_message | slack_events_raw | team_id, channel_id, message_ts |
idx_slack_events_raw_status_received | slack_events_raw | processing_status, received_at |
idx_slack_messages_thread | slack_messages | team_id, channel_id, thread_ts |
idx_slack_messages_channel_updated | slack_messages | team_id, channel_id, updated_at DESC |
idx_slack_messages_is_deleted | slack_messages | is_deleted |
idx_operating_timeline_events_workspace_status | operating_timeline_events | workspace_name, event_status |
idx_operating_timeline_events_type_discovered | operating_timeline_events | event_type, discovered_at DESC |
idx_operating_timeline_events_client_registry | operating_timeline_events | client_registry_id |
idx_operating_timeline_event_links_from | operating_timeline_event_links | from_event_id |
idx_operating_timeline_event_links_to | operating_timeline_event_links | to_event_id |
idx_slack_channel_policies_team_channel | slack_channel_policies | team_id, channel_id |
idx_slack_channel_policies_team_priority | slack_channel_policies | team_id, priority ASC, created_at ASC |
idx_slack_channel_coverage_events_channel_created | slack_channel_coverage_events | team_id, channel_id, created_at DESC |
idx_slack_channel_coverage_events_type_created | slack_channel_coverage_events | event_type, created_at DESC |
idx_operating_intake_items_slack_thread_unique | operating_intake_items | team_id, channel_id, thread_ts |
idx_operating_intake_items_review_status | operating_intake_items | review_status, created_at DESC |
idx_brain_writeback_queue_status_created | brain_writeback_queue | writeback_status, created_at ASC |
idx_client_onboardings_stage | client_onboardings | stage |
idx_client_onboardings_workspace | client_onboardings | client_workspace_name |
idx_client_onboardings_started | client_onboardings | started_at DESC |
idx_infra_orders_onboarding | infrastructure_orders | client_onboarding_id |
idx_onboarding_steps_open | onboarding_steps | status |
idx_onboarding_steps_onboarding | onboarding_steps | client_onboarding_id |
idx_ev_second_pass_queue_status | email_verification_second_pass_queue | queue_status, created_at |
idx_ev_second_pass_queue_workspace_month | email_verification_second_pass_queue | workspace_name, month, queue_status |
idx_ev_second_pass_queue_email | email_verification_second_pass_queue | email |
idx_operating_entities_canonical_name | operating_entities | canonical_name |
idx_operating_entities_last_seen | operating_entities | last_seen_at DESC |
idx_operating_entity_matches_source_entity | operating_entity_matches | source_system, source_ref_key, entity_id |
idx_operating_entity_matches_thread_primary | operating_entity_matches | thread_id, is_primary |
idx_operating_entity_matches_event_primary | operating_entity_matches | source_event_id, is_primary |
idx_operating_entity_matches_type_band | operating_entity_matches | entity_type, confidence_band |
idx_operating_classifications_source_ref_once | operating_intake_classifications | source_system, source_ref_key |
idx_operating_classifications_thread | operating_intake_classifications | thread_id |
idx_operating_classifications_event | operating_intake_classifications | source_event_id |
idx_operating_classifications_outcome_created | operating_intake_classifications | outcome, created_at DESC |
idx_operating_classifications_high_risk_band | operating_intake_classifications | high_risk, confidence_band |
idx_operating_review_items_status_created | operating_intake_review_items | status, created_at DESC |
idx_operating_review_items_queue_status | operating_intake_review_items | review_queue, status |
idx_operating_review_items_source_ref | operating_intake_review_items | source_system, source_ref_key |
idx_operating_review_items_client_workspace | operating_intake_review_items | client_workspace_name |
idx_operating_review_items_suggested_owner | operating_intake_review_items | suggested_owner_user_id |
idx_operating_writebacks_target_status | operating_intake_writebacks | target_system, status |
idx_operating_writebacks_review_item | operating_intake_writebacks | review_item_id |
idx_operating_writebacks_create_task_once | operating_intake_writebacks | review_item_id |
idx_operating_digest_runs_type_period | operating_digest_runs | digest_type, period_start DESC, period_end DESC |
idx_operating_entity_aliases_unique_active | operating_entity_aliases | `entity_type, |
| normalized_alias, | ||
| alias_type` | ||
idx_operating_entity_aliases_lookup | operating_entity_aliases | entity_type, normalized_alias, status |
idx_operating_entity_aliases_entity_id | operating_entity_aliases | entity_id |
idx_operating_entity_aliases_created_by | operating_entity_aliases | created_by |
idx_operating_entity_aliases_reviewed_by | operating_entity_aliases | reviewed_by |
idx_operating_timeline_events_event_key_unique | operating_timeline_events | event_key |
idx_operating_timeline_events_client_date | operating_timeline_events | client_registry_id, occurred_at DESC |
idx_operating_timeline_events_entity_date | operating_timeline_events | entity_id, occurred_at DESC |
idx_operating_timeline_events_process | operating_timeline_events | process_ref, occurred_at DESC |
idx_operating_timeline_event_links_unique | operating_timeline_event_links | from_event_id, to_event_id, link_type |
idx_operating_brain_patch_candidates_dedupe | operating_brain_patch_candidates | target_note_path, target_anchor, patch_type, process_key, patch_hash |
idx_operating_brain_patch_candidates_promotion_run | operating_brain_patch_candidates | promotion_run_id |
idx_operating_brain_patch_candidates_reviewed_by | operating_brain_patch_candidates | reviewed_by |
idx_operating_intake_items_client_id | operating_intake_items | client_id |
idx_brain_writeback_queue_source_item_id | brain_writeback_queue | source_item_id |
idx_operating_entity_aliases_entity_id | operating_entity_aliases | entity_id |
idx_operating_entity_aliases_created_by | operating_entity_aliases | created_by |
idx_operating_entity_aliases_reviewed_by | operating_entity_aliases | reviewed_by |
idx_operating_brain_patch_candidates_promotion_run | operating_brain_patch_candidates | promotion_run_id |
idx_operating_brain_patch_candidates_reviewed_by | operating_brain_patch_candidates | reviewed_by |
idx_operating_backfill_items_job_status | operating_backfill_items | job_id, status, attempts ASC, source_ref_key ASC |
uq_audit_findings_open | audit_findings | workspace_name, check_key |
idx_audit_findings_status_open | audit_findings | last_seen_date DESC |
idx_audit_findings_workspace | audit_findings | workspace_name, last_seen_date DESC |
idx_operating_timeline_summary_repair_backup_event_id | operating_timeline_summary_repair_backup | event_id |
idx_operating_timeline_summary_repair_backup_repair_run_id | operating_timeline_summary_repair_backup | repair_run_id |
idx_auto_forward_config_workspace_name | auto_forward_config | workspace_name |
idx_auto_forward_log_bison_reply_numeric_id | auto_forward_log | bison_reply_numeric_id |
idx_auto_forward_log_workspace_name | auto_forward_log | workspace_name, created_at DESC |
idx_auto_forward_log_lead_email | auto_forward_log | lead_email, created_at DESC |
idx_auto_forward_log_lead_reply_id | auto_forward_log | lead_reply_id |
idx_infra_orders_bison_campaign_id | infrastructure_orders | bison_campaign_id |
idx_infra_orders_needs_review | infrastructure_orders | needs_review |
idx_wdf_run | workspace_diagnostics_findings | run_id |
idx_wdf_workspace | workspace_diagnostics_findings | workspace_name, created_at DESC |
idx_wdf_check | workspace_diagnostics_findings | check_code, created_at DESC |
idx_email_accounts_infra_order | email_accounts | infrastructure_order_id |
idx_email_accounts_unlinked_warming | email_accounts | workspace_name |
idx_client_announcements_status | client_announcements | status |
idx_client_announcements_created_at | client_announcements | created_at DESC |
uq_announcement_delivery | announcement_deliveries | announcement_id, workspace_name, channel, recipient |
idx_announcement_deliveries_announcement | announcement_deliveries | announcement_id |
uq_announcement_read | announcement_reads | announcement_id, user_id |
idx_announcement_reads_user | announcement_reads | user_id |
uq_announcement_email_optout | announcement_email_optouts | workspace_name, email |
uq_announcement_extra_recipient | announcement_extra_recipients | workspace_name, email |
idx_order_send_activity_snapshot_date | order_send_activity | snapshot_date |
idx_infra_workspace_daily_snapshot_date | infra_workspace_daily | snapshot_date |
uq_announcement_source_event | client_announcements | source_event_key |
idx_client_announcements_source | client_announcements | source |
uq_sender_disconnect_open | sender_disconnect_state | workspace_name, email_address |
idx_sds_open_first_seen | sender_disconnect_state | first_disconnected_at |
idx_sds_workspace | sender_disconnect_state | workspace_name |
uq_account_deletion_queue_pending | account_deletion_queue | bison_sender_email_id |
idx_account_deletion_queue_status_workspace | account_deletion_queue | status, workspace_name |
uq_burnt_cohorts_open | burnt_cohorts | workspace_name, root_domain |
idx_burnt_cohorts_scan_week | burnt_cohorts | scan_week DESC |
idx_burnt_cohorts_status | burnt_cohorts | status |
idx_burnt_cohorts_delete_after | burnt_cohorts | delete_after |
idx_infra_orders_replaces_cohort | infrastructure_orders | replaces_cohort_id |