Database Schema
Every table, column, index, and constraint from SQL migrations
351 migrations | 272 tables | 616 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) |
| 162 | 162_resources_workspace_targeting.sql | (alter/index only) |
| 162 | 162_spam_block_events_dsn_body.sql | (alter/index only) |
| 163 | 163_burnt_domains_warmup_score_connected_only.sql | (alter/index only) |
| 164 | 164_volume_tracking_failed_sends.sql | (alter/index only) |
| 165 | 165_burnt_domains_drop_warmup_score_gate.sql | (alter/index only) |
| 165 | 165_failed_send_definition_stopped.sql | (alter/index only) |
| 165 | 165_reseller_disconnect_slack_channel.sql | (alter/index only) |
| 166 | 166_sending_while_prelive.sql | (alter/index only) |
| 166 | 166_warmup_health.sql | warmup_health |
| 167 | 167_announcement_email_override.sql | (alter/index only) |
| 168 | 168_client_metrics_measurement_status.sql | (alter/index only) |
| 169 | 169_bounce_storm_counts_rpc.sql | (alter/index only) |
| 170 | 170_reconnect_attempt_state.sql | (alter/index only) |
| 171 | 171_reconnect_domain_exclusions.sql | reconnect_domain_exclusions |
| 172 | 172_ms365_panel_tracking.sql | ms365_panels |
| 173 | 173_expired_token_snapshot.sql | expired_token_snapshot |
| 174 | 174_shared_preferred_zips.sql | (alter/index only) |
| 175 | 175_hall_of_fame_quality_gate.sql | (alter/index only) |
| 176 | 176_undeliverable_sends_tracking.sql | (alter/index only) |
| 177 | 177_reconnect_daily_cohort.sql | reconnect_daily_cohort |
| 178 | 178_reconnect_priority.sql | (alter/index only) |
| 178 | 178_schedule_timezone_rule.sql | (alter/index only) |
| 178 | 178_windowed_leaderboards.sql | (alter/index only) |
| 179 | 179_raw_contacts_scrub_index.sql | (alter/index only) |
| 180 | 180_maverick_mcp_registry.sql | mcp_users, mcp_audit_log, key_candidates, mcp_audit_runs, mcp_audit_findings |
| 181 | 181_bounce_wave_autodetach.sql | (alter/index only) |
| 182 | 182_revoke_vault_rpc_grants.sql | (alter/index only) |
| 183 | 183_job_runs.sql | job_runs |
| 184 | 184_kpi_shadow_compare.sql | kpi_shadow_compare |
| 185 | 185_workspace_window_stats.sql | workspace_window_stats |
| 186 | 186_intraday_pacing.sql | intraday_snapshots |
| 187 | 187_audience_renewal_timing_and_reply_timing.sql | audit_reply_timing_stats |
| 188 | 188_audience_income_net_worth.sql | (alter/index only) |
| 189 | 189_mcp_known_causes.sql | mcp_known_causes |
| 202608211200 | 202608211200_schema_migrations_ledger.sql | schema_migrations |
| 202608251200 | 202608251200_mcp_mailbox_upload_rule.sql | (alter/index only) |
| 202608251730 | 202608251730_registry_identity_integrity.sql | (alter/index only) |
| 202608261500 | 202608261500_interested_review_gate.sql | interested_review_queue |
| 202608271300 | 202608271300_client_registry_lead_cap_exempt.sql | (alter/index only) |
| 202609021030 | 202609021030_increment_daily_interested_update_only.sql | (alter/index only) |
| 202609050012 | 202609050012_mcp_internal_table_access.sql | (alter/index only) |
| 202609061200 | 202609061200_client_registry_bison_instance_maverick_2.sql | (alter/index only) |
| 202609071900 | 202609071900_bison_tokens_team_id_per_instance.sql | (alter/index only) |
| 202609081700 | 202609081700_tasks_slack_outbound_switch.sql | (alter/index only) |
| 202609081710 | 202609081710_mcp_users_user_profile_id.sql | (alter/index only) |
| 202609091700 | 202609091700_task_proposals.sql | task_proposal_batches, task_proposals |
| 202609091800 | 202609091800_task_proposal_pending_review.sql | (alter/index only) |
| 202609091810 | 202609091810_task_collaborators.sql | (alter/index only) |
| 202609091900 | 202609091900_task_bot_events.sql | task_bot_events |
| 202609091910 | 202609091910_task_bot_events_observer_route.sql | (alter/index only) |
| 202609100900 | 202609100900_close_wide_open_rls_policies.sql | (alter/index only) |
| 202609100901 | 202609100901_email_accounts_instance_identity.sql | (alter/index only) |
| 202609100905 | 202609100905_email_accounts_drop_global_sender_unique.sql | (alter/index only) |
| 202609100910 | 202609100910_account_sync_waves_presence.sql | account_sync_waves |
| 202609100920 | 202609100920_bison_status_canon_check.sql | (alter/index only) |
| 202609100925 | 202609100925_account_sync_waves_drift_blocked_status.sql | (alter/index only) |
| 202609100930 | 202609100930_summary_presence_rpc.sql | (alter/index only) |
| 202609101300 | 202609101300_nurture_queue.sql | nurture_candidates |
| 202609101400 | 202609101400_task_bot_events_task_ids.sql | (alter/index only) |
| 202609101700 | 202609101700_nurture_rejected_status.sql | (alter/index only) |
| 202609101800 | 202609101800_nurture_send_attempt.sql | (alter/index only) |
| 202609101900 | 202609101900_nurture_claims_and_send_check.sql | (alter/index only) |
| 202609102000 | 202609102000_nurture_followup_source.sql | (alter/index only) |
| 202609111300 | 202609111300_nurture_later_and_review_link.sql | (alter/index only) |
| 202609141200 | 202609141200_bison_status_canon_tighten.sql | (alter/index only) |
| 202609141200 | 202609141200_nurture_greet_and_links.sql | (alter/index only) |
| 202609151100 | 202609151100_present_tag_dimension_rpcs.sql | (alter/index only) |
| 202609151130 | 202609151130_task_person_labels.sql | task_person_labels |
| 202609151200 | 202609151200_nurture_targeting.sql | (alter/index only) |
| 202609151817 | 202609151817_kpi_client_controls.sql | kpi_client_settings_audit |
| 202609152000 | 202609152000_per_workspace_tag_rpcs.sql | (alter/index only) |
| 202609160900 | 202609160900_lifecycle_aggregate_rpcs.sql | (alter/index only) |
| 202609161000 | 202609161000_lifecycle_provider_caps.sql | (alter/index only) |
| 202609162100 | 202609162100_nurture_lab_runs.sql | nurture_lab_runs |
| 202609171200 | 202609171200_domain_daily_stats.sql | domain_daily_stats, domain_stats_runs |
| 202609172330 | 202609172330_domain_stats_absent.sql | (alter/index only) |
| 202609181200 | 202609181200_domain_stats_read_rpcs.sql | (alter/index only) |
| 202609181230 | 202609181230_tasks_dm_channel_pin.sql | (alter/index only) |
| 202609181400 | 202609181400_infra_account_targets.sql | infra_sizing_standards, client_infra_targets, infra_targets_audit |
| 202609181600 | 202609181600_drop_unused_raw_contacts_indexes.sql | (alter/index only) |
| 202609182000 | 202609182000_domain_burn_by_workspace.sql | (alter/index only) |
| 202609190300 | 202609190300_domain_burn_client_lane.sql | (alter/index only) |
| 202609191200 | 202609191200_registrar_roster.sql | registrar_accounts, registrar_domains, registrar_secret_reveals, registrar_burn_seeds |
| 202609191210 | 202609191210_registrar_roster_seed_burn.sql | (alter/index only) |
| 202609191500 | 202609191500_aip_ws2_mailin_vendor_orders.sql | infra_vendor_orders, infra_vendor_tickets, infra_sender_moves, infra_credstore_pulls |
| 202609191900 | 202609191900_registrar_roster_burn_signals.sql | (alter/index only) |
| 202609200800 | 202609200800_aip_ws1_pipeline_ledger.sql | infra_pipeline_steps |
| 202609200900 | 202609200900_aip_ws4_domain_purchase_plans.sql | domain_purchase_plans, domain_purchase_items |
| 202609200910 | 202609200910_aip_ws4_domain_dns_intents.sql | domain_dns_intents |
| 202609201000 | 202609201000_aip_ws3_ms365_provisioning_registry.sql | ms365_provisioning_runs, ms365_provisioning_run_logs, ms365_seat_reservations, ms365_recon_findings |
| 202609211500 | 202609211500_domain_burn_root_rule.sql | (alter/index only) |
| 20260921215703 | 20260921215703_daily_bounce_candidates.sql | (alter/index only) |
| 202609212200 | 202609212200_ms365_panel_tags.sql | ms365_domain_tenants, ms365_panel_tag_runs |
| 202609212300 | 202609212300_aip_ws4_assignment_recovery.sql | domain_root_assignments |
| 202609212300 | 202609212300_ms365_panel_tag_runs_mode.sql | (alter/index only) |
| 20260922041636 | 20260922041636_aip_ws2_canary_reservations.sql | infra_ws2_canary_policies, infra_ws2_canary_scopes, infra_ws2_canary_reservations |
| 202609220500 | 202609220500_aip_ws1_observation_history.sql | infra_pipeline_step_observations |
| 202609220520 | 202609220520_aip_ws4_root_usage_privileges.sql | (alter/index only) |
| 202609221100 | 202609221100_ms365_panel_terrl.sql | (alter/index only) |
| 202609221100 | 202609221100_task_proposal_collaborators.sql | (alter/index only) |
| 202609221200.sql | 202609221200.sql | (alter/index only) |
| 202609221230 | 202609221230_ms365_panel_warmup.sql | (alter/index only) |
| 202609221330 | 202609221330_warmup_daily_pull.sql | (alter/index only) |
| 20260922142229 | 20260922142229_bounce_digest_receipts.sql | bounce_digest_events |
| 20260922155704 | 20260922155704_aip_ws5_warmup_gate.sql | warmup_gate_snapshots |
| 20260922162310 | 20260922162310_aip_ws6_infra_board_placement_rpc.sql | (alter/index only) |
| 202609231300 | 202609231300_ms365_panel_today.sql | (alter/index only) |
| 202609232000.sql | 202609232000.sql | (alter/index only) |
| 202609232200.sql | 202609232200.sql | (alter/index only) |
| 202609240800 | 202609240800_panel_cap_ramp.sql | mailbox_limit_ledger, panel_budget_snapshots |
| 202609240900 | 202609240900_task_reconciler.sql | task_evidence |
| 202609240930 | 202609240930_task_context_outbox.sql | client_call_notes, vault_outbox |
| 202609241000 | 202609241000_meeting_schedule.sql | meeting_schedule |
| 202609241300 | 202609241300_work_foundations.sql | work_ownership_rules, work_rules, work_rule_overrides, work_entity_disagreements |
| 202609241400 | 202609241400_work_items.sql | work_findings_config, work_findings_log |
| 202609241430 | 202609241430_llm_traces.sql | llm_traces |
| 202609241500 | 202609241500_brain_index.sql | brain_notes, brain_chunks, brain_links, brain_index_state |
| 202609241530 | 202609241530_work_handoffs.sql | work_handoffs |
| 202609250800 | 202609250800_lead_loss_checks.sql | lead_loss_checks |
| 202609251200 | 202609251200_exec_briefs.sql | exec_briefs, exec_brief_state, exec_brief_feedback |
| 20260925215015 | 20260925215015_aip_ws4_operator_mcp_claim.sql | domain_purchase_operator_attempts |
| 202609270130 | 202609270130_mailin_destination_bindings.sql | infra_mailin_destination_bindings |
| 20260927014309 | 20260927014309_aip_ws4_operator_expansions.sql | domain_purchase_operator_expansions, domain_purchase_operator_expansion_bindings |
| 20260927015402 | 20260927015402_mailin_scoped_arrival.sql | (alter/index only) |
| 20260927182518 | 20260927182518_mailin_pilot_approval.sql | infra_ws2_canary_revocations |
| 20260928000001 | 20260928000001_ms365_pilot_delivery.sql | ms365_pilot_delivery_receipts |
| 20260928040000 | 20260928040000_ms365_child_units_owned_roots.sql | domain_owned_root_adoptions |
| 202609281600 | 202609281600_bounce_signal_windows.sql | (alter/index only) |
| 202609281900 | 202609281900_bounce_signal_windows_v2.sql | (alter/index only) |
| 202609282100 | 202609282100_bison_change_log.sql | bison_change_log |
| 202609291700 | 202609291700_runtime_policies.sql | runtime_policies |
| 202609292000 | 202609292000_snapshot_mode_trigger.sql | (alter/index only) |
| 202609300745 | 202609300745_panel_plan_reviews.sql | panel_plan_reviews |
| 202609301600 | 202609301600_lead_claim_sync.sql | lead_claim_config, lead_owners, lead_claim_events |
| 202610010900 | 202610010900_lead_claim_email_notes.sql | (alter/index only) |
| 202610010900 | 202610010900_operator_tables.sql | campaign_rosters, infra_decisions, infra_runs, email_account_limit_changes, operator_box_stats_cache |
| 202610011100 | 202610011100_operator_box_stats_single_scan.sql | (alter/index only) |
| 202610011300 | 202610011300_operator_feedback.sql | operator_feedback |
| 202610011445 | 202610011445_campaign_rosters_page_index.sql | (alter/index only) |
| 202610011500 | 202610011500_burnt_lifecycle.sql | burnt_verdicts, burnt_roots, campaign_roster_refreshes |
| 202610011800 | 202610011800_lead_claim_clickup.sql | lead_claim_clickup_tasks, lead_claim_clickup_posts, lead_claim_clickup_backlog, lead_claim_clickup_state |
| 202610041300 | 202610041300_ops_alerts.sql | ops_alerts, ops_alert_prefs, desktop_app_policy, ops_alert_routes |
| 202610051400 | 202610051400_burnt_probation.sql | (alter/index only) |
| 202610051500 | 202610051500_bounce_wave_lane_params.sql | (alter/index only) |
| 202610052000 | 202610052000_bounce_wave_operator.sql | (alter/index only) |
| 202610052300 | 202610052300_ws4_configurable_claim_pacing.sql | (alter/index only) |
| 202610061400 | 202610061400_box_stats_dump_guard.sql | (alter/index only) |
| 202610091900 | 202610091900_campaign_pause_operator.sql | (alter/index only) |
| 202610092300 | 202610092300_copy_variant_evidence.sql | (alter/index only) |
| 202610120115 | 202610120115_copy_reply_lookup.sql | (alter/index only) |
| 202610120116 | 202610120116_copy_query_plans.sql | (alter/index only) |
| 202610120117 | 202610120117_copy_activity_custom_plan.sql | (alter/index only) |
| 202610121200 | 202610121200_ws4_approval_sets_spend_cap.sql | (alter/index only) |
| 202610131210 | 202610131210_kpi_reporting_reason.sql | (alter/index only) |
| 202610131900 | 202610131900_burnt_winddown.sql | (alter/index only) |
| 20261013220000 | 20261013220000_fairplan_replies.sql | fairplan_replies |
| 202610141500 | 202610141500_operator_rails.sql | operator_box_snapshots |
| 202610142200 | 202610142200_operator_origins_ledger.sql | operator_box_origins, operator_fleet_ledger |
| 202610142300 | 202610142300_backup_orders.sql | (alter/index only) |
| 202610171210 | 202610171210_registrar_purchase_observations.sql | registrar_domain_observations |
| 202610171220 | 202610171220_registrar_lifecycle_coverage.sql | (alter/index only) |
| 202610171230 | 202610171230_domain_lifecycle_alerts.sql | domain_lifecycle_alert_deliveries, domain_lifecycle_alert_events |
| 202610191200 | 202610191200_registrar_account_coverage.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
Resolved entities (people, clients, workspaces, panels, domain roots, repos, systems). One row per real thing; every name for it lives in operating_entity_aliases.
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
Every string that names an entity: names, first names, Slack ids, emails, GitHub logins, vault slugs and note paths, workspace ids. Resolution only trusts status=approved rows.
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() |
warmup_health
Defined in: 166_warmup_health.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
workspace_name | TEXT | NOT NULL |
root_domain | TEXT | NOT NULL |
scan_run_id | TEXT | NOT NULL, -- YYYY-MM-DD-HHMM (scan invocation stamp) |
first_detected_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
last_seen_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
avg_warmup_score | NUMERIC | NOT NULL |
account_count | INTEGER | NOT NULL, -- total accts on this (ws, root_domain) |
signal_count | INTEGER | NOT NULL, -- accts with warmup_emails_sent >= 10 (contribute to avg) |
accts_le_70 | INTEGER | NOT NULL, -- how many of signal_count are individually <= 70 |
account_ids | INTEGER[] | NOT NULL, -- Bison sender_email_ids on this domain |
date_tags | TEXT[] | NOT NULL DEFAULT '{}', -- distinct '7/9', '3/20', etc. across the domain |
infra_tags | TEXT[] | NOT NULL DEFAULT '{}', -- distinct 'Azure','Mailin','MS365 Panel', etc. |
signals | JSONB | NOT NULL DEFAULT '{}'::jsonb, -- misc raw fields (min/max score, top offenders, etc.) |
status | TEXT | NOT NULL DEFAULT 'detected' |
resolved_at | TIMESTAMPTZ | |
resolved_by | TEXT | |
dismissed_at | TIMESTAMPTZ | |
dismissed_by | TEXT | |
notes | TEXT | |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
reconnect_domain_exclusions
Domains the reconnect executor must never attempt. Ops-editable; the executor reads it fresh every run.
Defined in: 171_reconnect_domain_exclusions.sql
| Column | Type | Constraints |
|---|---|---|
domain | TEXT | PRIMARY KEY |
reason | TEXT | NOT NULL |
added_by | TEXT | NOT NULL |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
ms365_panels
*One row per MS365 panel (Azure tenant) we provision mailboxes on. Holds the capacity *
Defined in: 172_ms365_panel_tracking.sql
| Column | Type | Constraints |
|---|---|---|
panel_number | SMALLINT | PRIMARY KEY |
label | TEXT | NOT NULL |
tenant_id | UUID | NOT NULL UNIQUE |
kind | TEXT | NOT NULL CHECK (kind IN ('owned', 'reseller')) |
license_sku | TEXT | |
licenses_total | INTEGER | |
licenses_used | INTEGER | |
domains_verified | INTEGER | |
domain_cap | INTEGER | NOT NULL DEFAULT 5000 |
capacity_checked_at | TIMESTAMPTZ | |
accepts_new_domains | BOOLEAN | NOT NULL DEFAULT TRUE |
notes | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
expired_token_snapshot
Defined in: 173_expired_token_snapshot.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
run_date | DATE | NOT NULL |
workspace_name | TEXT | NOT NULL |
bison_sender_id | BIGINT | |
sender_name | TEXT | |
email_address | TEXT | NOT NULL |
tags | TEXT | |
provider | TEXT, | -- MS365 Panel / CheapInboxes / Mailin / ScaledMail / Azure Panel / Legacy Panel / ... |
owner | TEXT, | -- OURS (we reconnect) | VENDOR (they re-auth) |
captured_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
reconnect_daily_cohort
Defined in: 177_reconnect_daily_cohort.sql
| Column | Type | Constraints |
|---|---|---|
cohort_date | date | PRIMARY KEY |
detected_at | timestamptz | NOT NULL DEFAULT now() |
detected_count | integer | NOT NULL |
member_ids | jsonb | NOT NULL DEFAULT '[]'::jsonb |
status | text | NOT NULL DEFAULT 'open', -- 'open' | 'reported' |
reconnected_count | integer | |
unreconnectable_count | integer | |
still_working_count | integer | |
closed_at | timestamptz | |
post2_message | text | |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
mcp_users
Defined in: 180_maverick_mcp_registry.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
name | TEXT | NOT NULL UNIQUE |
token_hash | TEXT | NOT NULL UNIQUE, -- sha256 hex of the bearer token |
role | TEXT | NOT NULL DEFAULT 'operator' CHECK (role IN ('admin', 'operator')) |
is_active | BOOLEAN | NOT NULL DEFAULT TRUE |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
last_used_at | TIMESTAMPTZ |
mcp_audit_log
Defined in: 180_maverick_mcp_registry.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
user_id | UUID | REFERENCES mcp_users(id) ON DELETE CASCADE |
user_name | TEXT | NOT NULL, -- denormalized for cheap reads |
tool | TEXT | NOT NULL |
workspace_name | TEXT | |
args_summary | JSONB, | -- NEVER contains secret values |
status | TEXT | NOT NULL CHECK (status IN ('ok', 'error', 'denied')) |
duration_ms | INTEGER | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
key_candidates
Defined in: 180_maverick_mcp_registry.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
bison_key_id | INTEGER, | -- parsed from the key's "ID|token" prefix |
secret_ref | TEXT | NOT NULL, -- vault secret name; the key itself lives in Vault |
vault_secret_id | UUID, | -- vault row id (vault_delete_secret takes p_secret_id) |
provenance | TEXT | NOT NULL, -- e.g. 'local-md-2026-05-04', 'workspaces-json', 'one-pager' |
status | TEXT | NOT NULL DEFAULT 'pending' |
validated_workspace_name | TEXT, | -- what Bison said the key belongs to |
validated_team_id | INTEGER | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
mcp_audit_runs
Defined in: 180_maverick_mcp_registry.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workflow | TEXT | NOT NULL, -- 'volume_audit' | 'key_census' | ... |
scope | JSONB, | -- {"workspaces": [...]} or null = all active |
requested_by | UUID | REFERENCES mcp_users(id) |
requested_by_name | TEXT | |
status | TEXT | NOT NULL DEFAULT 'queued' |
celery_task_id | TEXT | |
summary | JSONB, | -- counts per finding_class, error list |
started_at | TIMESTAMPTZ | |
finished_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
mcp_audit_findings
Defined in: 180_maverick_mcp_registry.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
run_id | UUID | NOT NULL REFERENCES mcp_audit_runs(id) ON DELETE CASCADE |
workspace_name | TEXT | NOT NULL |
finding_class | TEXT | NOT NULL, -- 'F1_unsequenced' | 'F2_ramp_drift' | 'F3_unattached_healthy' | 'F5_tag_canon' | 'audit_error' | census classes |
severity | TEXT | NOT NULL DEFAULT 'warn' CHECK (severity IN ('info', 'warn', 'high')) |
evidence | JSONB | NOT NULL, -- the numbers; NEVER secret values |
proposed_fix | JSONB, | -- null when no auto-proposable fix (F4/F6 class) |
status | TEXT | NOT NULL DEFAULT 'proposed' |
approved_by | UUID | REFERENCES mcp_users(id) |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
job_runs
Defined in: 183_job_runs.sql
| Column | Type | Constraints |
|---|---|---|
id | text | PRIMARY KEY |
task_name | text | NOT NULL |
scope | text | |
state | text | NOT NULL DEFAULT 'running' CHECK (state IN ('running', 'succeeded', 'failed')) |
progress_current | integer | |
progress_total | integer | |
note | text | |
result | jsonb | |
error | text | |
started_at | timestamptz | NOT NULL DEFAULT now() |
finished_at | timestamptz | |
expected_next_at | timestamptz |
kpi_shadow_compare
Defined in: 184_kpi_shadow_compare.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
run_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
workspace_name | TEXT | NOT NULL |
deltas | JSONB | NOT NULL |
workspace_window_stats
Defined in: 185_workspace_window_stats.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
window_days | INTEGER | NOT NULL CHECK (window_days IN (0, 30, 60, 90)) |
start_date | DATE | NOT NULL |
end_date | DATE | NOT NULL |
emails_sent | BIGINT | |
total_leads_contacted | BIGINT | |
synced_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
intraday_snapshots
Defined in: 186_intraday_pacing.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | text | NOT NULL |
chicago_day | date | NOT NULL |
minutes_into_day | int | NOT NULL |
snapshot_at | timestamptz | NOT NULL DEFAULT now() |
emails_sent | int | |
replies | int | |
interested | int |
audit_reply_timing_stats
Reply-timing analytics: time-to-reply distribution + reply day-of-week/hour-of-day (Chicago), split interested vs other. Per-REPLY denominator (NEVER the audience table
Defined in: 187_audience_renewal_timing_and_reply_timing.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
dimension | TEXT | NOT NULL CHECK (dimension IN ('time_to_reply', 'reply_dow', 'reply_hour')) |
bucket | TEXT | NOT NULL |
bucket_order | INTEGER | NOT NULL DEFAULT 50 |
replies | BIGINT | NOT NULL DEFAULT 0 |
interested | BIGINT | NOT NULL DEFAULT 0 |
computed_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
mcp_known_causes
Defined in: 189_mcp_known_causes.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT, | -- NULL = any workspace |
finding_class | TEXT, | -- NULL = any class (e.g. 'VD_unsequenced', 'F1_unsequenced') |
campaign_id | INTEGER, | -- NULL = any campaign |
verdict | TEXT | NOT NULL, -- suggested: known_cause | registry_hygiene | |
reason | TEXT | NOT NULL, -- human explanation; shown in evidence.disposition |
created_by | UUID | REFERENCES mcp_users(id) |
created_by_name | TEXT | |
expires_at | TIMESTAMPTZ, | -- NULL = standing until deactivated |
is_active | BOOLEAN | NOT NULL DEFAULT TRUE |
created_at | TIMESTAMPTZ | DEFAULT NOW() |
updated_at | TIMESTAMPTZ | DEFAULT NOW() |
schema_migrations
Defined in: 202608211200_schema_migrations_ledger.sql
| Column | Type | Constraints |
|---|---|---|
version | text | PRIMARY KEY, -- filename without .sql |
checksum | text | NOT NULL, -- sha256 of file bytes at apply time |
applied_at | timestamptz | NOT NULL DEFAULT now() |
applied_by | text | NOT NULL -- 'migrate.py:<operator>' | 'backfill' |
interested_review_queue
Defined in: 202608261500_interested_review_gate.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | NOT NULL |
bison_reply_uuid | TEXT | |
lead_reply_id | UUID, | -- lead_replies.id when matched at hold time |
payload | JSONB | NOT NULL, -- original webhook payload, replayed on release |
cleaned_reply | TEXT | |
audit_confidence | INTEGER | |
audit_reasoning | TEXT | |
status | TEXT | NOT NULL DEFAULT 'pending' |
decided_by | TEXT, | -- email | 'system:ttl_auto_release' | 'system:subsequent_interest' |
decided_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
task_proposal_batches
One meeting transcript -> one batch of task proposals awaiting the reviewer
Defined in: 202609091700_task_proposals.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
meeting | text | NOT NULL |
source_hash | text | |
created_by | uuid | REFERENCES public.user_profiles(id) |
reviewer_id | uuid | REFERENCES public.user_profiles(id) |
status | text | NOT NULL DEFAULT 'proposed' |
slack_channel_id | text | |
slack_ts | text | |
summary | jsonb | NOT NULL DEFAULT '{}'::jsonb |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
task_proposals
Numbered proposals inside a batch. status moves proposed -> approved/dropped/deferred/asked -> applied/failed.
Defined in: 202609091700_task_proposals.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
batch_id | uuid | NOT NULL REFERENCES public.task_proposal_batches(id) ON DELETE CASCADE |
n | int | NOT NULL |
kind | text | NOT NULL |
task_id | uuid | REFERENCES public.tasks(id) ON DELETE SET NULL |
assignee_id | uuid | REFERENCES public.user_profiles(id) |
title | text | |
due_date | date | |
priority | text | |
note | text | |
quote | text | |
confidence | numeric | |
decision | text | |
decision_note | text | |
applied_task_id | uuid | |
status | text | NOT NULL DEFAULT 'proposed' |
created_at | timestamptz | NOT NULL DEFAULT now() |
task_bot_events
One row per inbound DM to the Maverick Tasks bot: route, parsed intent, action, reply, model use, latency, error.
Defined in: 202609091900_task_bot_events.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
ts | timestamptz | NOT NULL DEFAULT now() |
slack_user_id | text | |
profile_id | uuid | REFERENCES public.user_profiles(id) ON DELETE SET NULL |
channel_id | text | |
inbound_text | text | |
route | text | |
intent_kind | text | |
confidence | numeric | |
action | text | |
task_id | uuid | REFERENCES public.tasks(id) ON DELETE SET NULL |
reply_text | text | |
model | text | |
llm_used | boolean | NOT NULL DEFAULT false |
latency_ms | integer | |
error | text |
account_sync_waves
One row per (wave_id, instance, workspace) account-sync pull. complete = presence for that workspace was fully re-stamped this wave. meta_ columns are the T4 per_page=1 Bison probes; drift = accounts_present - meta_total.*
Defined in: 202609100910_account_sync_waves_presence.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGINT | GENERATED ALWAYS AS IDENTITY PRIMARY KEY |
wave_id | UUID | NOT NULL |
bison_instance | TEXT | NOT NULL |
workspace_name | TEXT | NOT NULL |
started_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
completed_at | TIMESTAMPTZ | |
status | TEXT | NOT NULL DEFAULT 'running' |
reason | TEXT | |
accounts_present | INTEGER | |
meta_total | INTEGER | |
meta_connected | INTEGER | |
meta_not_connected | INTEGER | |
drift | INTEGER | |
drift_flagged | BOOLEAN | NOT NULL DEFAULT FALSE |
nurture_candidates
Defined in: 202609101300_nurture_queue.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | text | NOT NULL |
lead_email | text | NOT NULL |
lead_reply_id | uuid | NOT NULL |
bison_reply_numeric_id | bigint | |
first_name | text | |
sender_name | text | |
agency_name | text | |
reply_date | timestamptz | |
lead_text | text | |
source | text | NOT NULL DEFAULT 'not_interested' |
intent | text | |
confidence | integer | |
reasoning | text | |
recommendation | text | |
draft_text | text | |
draft_model | text | |
prompt_version | text | |
style_issues | jsonb | NOT NULL DEFAULT '[]'::jsonb |
status | text | NOT NULL DEFAULT 'drafted' |
batch_id | uuid | |
slack_channel | text | |
slack_ts | text | |
decided_by | text | |
decided_at | timestamptz | |
final_text | text | |
was_edited | boolean | |
edit_similarity | numeric | |
send_error | text | |
sent_at | timestamptz | |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
task_person_labels
The number each person sees for each task in Slack: stable until the task closes, never reused for that person.
Defined in: 202609151130_task_person_labels.sql
| Column | Type | Constraints |
|---|---|---|
profile_id | uuid | NOT NULL REFERENCES public.user_profiles(id) ON DELETE CASCADE |
task_id | uuid | NOT NULL REFERENCES public.tasks(id) ON DELETE CASCADE |
label | integer | NOT NULL CHECK (label > 0) |
created_at | timestamptz | NOT NULL DEFAULT now() |
kpi_client_settings_audit
Defined in: 202609151817_kpi_client_controls.sql
| Column | Type | Constraints |
|---|---|---|
id | bigint | GENERATED ALWAYS AS IDENTITY PRIMARY KEY |
workspace_name | text | NOT NULL REFERENCES public.client_registry(workspace_name) |
changed_at | timestamptz | NOT NULL DEFAULT now() |
actor | text | NOT NULL |
revision | bigint | NOT NULL |
before_settings | jsonb | NOT NULL |
after_settings | jsonb | NOT NULL |
nurture_lab_runs
Defined in: 202609162100_nurture_lab_runs.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
created_at | timestamptz | NOT NULL DEFAULT now() |
created_by | text | |
status | text | NOT NULL DEFAULT 'queued', -- queued | running | done | failed |
spec | jsonb | NOT NULL, -- {variants: [...], sample: {...}, judge: bool} |
results | jsonb, | -- {sample: [...], variants: [{name, summary, drafts: [...]}]} |
error | text | |
started_at | timestamptz | |
finished_at | timestamptz |
domain_daily_stats
Per (workspace, sender domain, day) campaign-event counts pulled from Bison GET /campaign-events/stats with sender_email_ids[] = the domain
Defined in: 202609171200_domain_daily_stats.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | text | NOT NULL |
domain | text | NOT NULL, -- lower(split_part(email_address, '@', 2)) |
root_domain | text | NOT NULL, -- last two labels of domain |
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 |
total_opens | integer | NOT NULL DEFAULT 0 |
unique_opens | integer | NOT NULL DEFAULT 0 |
unsubscribed | integer | NOT NULL DEFAULT 0 |
sender_count | integer | NOT NULL DEFAULT 0, -- present senders on the domain at pull time |
source | text | NOT NULL DEFAULT 'campaign_events' |
run_id | bigint | |
pulled_at | timestamptz | NOT NULL DEFAULT now() |
domain_stats_runs
Defined in: 202609171200_domain_daily_stats.sql
| Column | Type | Constraints |
|---|---|---|
id | bigserial | PRIMARY KEY |
mode | text | NOT NULL CHECK (mode IN ('nightly', 'backfill', 'probe')) |
workspace_name | text | NOT NULL |
window_start | date | NOT NULL |
window_end | date | NOT NULL |
started_at | timestamptz | NOT NULL DEFAULT now() |
finished_at | timestamptz | |
status | text | NOT NULL DEFAULT 'running' |
domains_total | integer | NOT NULL DEFAULT 0 |
domains_ok | integer | NOT NULL DEFAULT 0 |
api_calls | integer | NOT NULL DEFAULT 0 |
errors | integer | NOT NULL DEFAULT 0 |
error_sample | jsonb | |
reconciliation | jsonb | |
probe_result | jsonb | -- mode='probe' only: raw response shape, date labels, totals |
infra_sizing_standards
Default mailbox counts per client_type. per_100_leads scales with the effective monthly lead target; per_client is a flat count. Google has no quota.
Defined in: 202609181400_infra_account_targets.sql
| Column | Type | Constraints |
|---|---|---|
client_type | text | PRIMARY KEY CHECK (client_type IN ('home_insurance', 'commercial', 'other')) |
basis | text | NOT NULL CHECK (basis IN ('per_100_leads', 'per_client')) |
azure_accounts | integer | NOT NULL CHECK (azure_accounts >= 0) |
microsoft_accounts | integer | NOT NULL CHECK (microsoft_accounts >= 0) |
provisional | boolean | NOT NULL DEFAULT true |
revision | bigint | NOT NULL DEFAULT 0 |
updated_by | text | |
updated_at | timestamptz | NOT NULL DEFAULT now() |
client_infra_targets
Explicit per-client provider account targets. NULL = derive from infra_sizing_standards. 0 = intentionally none.
Defined in: 202609181400_infra_account_targets.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | text | PRIMARY KEY REFERENCES public.client_registry(workspace_name) |
azure_target | integer | CHECK (azure_target >= 0) |
microsoft_target | integer | CHECK (microsoft_target >= 0) |
revision | bigint | NOT NULL DEFAULT 0 |
updated_by | text | |
updated_at | timestamptz | NOT NULL DEFAULT now() |
created_at | timestamptz | NOT NULL DEFAULT now() |
infra_targets_audit
Defined in: 202609181400_infra_account_targets.sql
| Column | Type | Constraints |
|---|---|---|
id | bigint | GENERATED ALWAYS AS IDENTITY PRIMARY KEY |
scope | text | NOT NULL CHECK (scope IN ('client', 'standard')) |
key | text | NOT NULL |
changed_at | timestamptz | NOT NULL DEFAULT now() |
actor | text | NOT NULL |
revision | bigint | NOT NULL |
before_state | jsonb | NOT NULL |
after_state | jsonb | NOT NULL |
registrar_accounts
Defined in: 202609191200_registrar_roster.sql
| Column | Type | Constraints |
|---|---|---|
id | serial | PRIMARY KEY |
registrar | text | NOT NULL CHECK (registrar IN ('spaceship','namecheap','godaddy')) |
label | text | NOT NULL UNIQUE |
owner | text | |
login_email | text | |
access_mode | text | NOT NULL DEFAULT 'none' CHECK (access_mode IN ('api','csv','none')) |
access_status | text | NOT NULL DEFAULT 'missing' |
assignee | text | |
api_secret_ref | text, | -- vault secret NAME (registrar_api_<id>) |
api_secret_id | uuid, | -- vault secret id (for rotate/delete) |
login_secret_ref | text, | -- vault secret NAME (registrar_login_<id>) |
login_secret_id | uuid | |
client_owned | boolean | NOT NULL DEFAULT false |
csv_inbox_path | text | |
last_pull_at | timestamptz | |
last_pull_count | integer | |
last_error | text | |
notes | text | |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
registrar_domains
Defined in: 202609191200_registrar_roster.sql
| Column | Type | Constraints |
|---|---|---|
root | text | NOT NULL |
account_id | integer | NOT NULL REFERENCES public.registrar_accounts(id) ON DELETE CASCADE |
registration_date | date | |
expiration_date | date | |
auto_renew | boolean | |
registrar_status | text | |
nameservers | text[] | |
do_not_renew | boolean | NOT NULL DEFAULT false |
do_not_renew_by | text | |
do_not_renew_at | timestamptz | |
burn_source | text | |
first_seen_at | timestamptz | NOT NULL DEFAULT now() |
last_seen_at | timestamptz | NOT NULL DEFAULT now() |
registrar_secret_reveals
Defined in: 202609191200_registrar_roster.sql
| Column | Type | Constraints |
|---|---|---|
id | serial | PRIMARY KEY |
account_id | integer | NOT NULL REFERENCES public.registrar_accounts(id) ON DELETE CASCADE |
secret_kind | text | NOT NULL CHECK (secret_kind IN ('api','login')) |
revealed_by | text | NOT NULL |
revealed_at | timestamptz | NOT NULL DEFAULT now() |
registrar_burn_seeds
Defined in: 202609191200_registrar_roster.sql
| Column | Type | Constraints |
|---|---|---|
root | text | PRIMARY KEY |
burn_source | text | NOT NULL |
created_at | timestamptz | NOT NULL DEFAULT now() |
infra_vendor_orders
Defined in: 202609191500_aip_ws2_mailin_vendor_orders.sql
| Column | Type | Constraints |
|---|---|---|
id | serial | PRIMARY KEY |
infrastructure_order_id | integer | NOT NULL REFERENCES public.infrastructure_orders(id) ON DELETE CASCADE |
vendor | text | NOT NULL DEFAULT 'mailin' |
vendor_order_id | text | |
root | text, | -- one Mailin order = one domain (100 boxes) |
roots | jsonb | NOT NULL DEFAULT '[]'::jsonb |
destination_workspace | text | |
destination_bison_workspace_id | integer | |
bison_instance | text | |
persona | text | |
quantity | integer | |
required_nameservers | jsonb, | -- from GET /azure-orders/nameservers/{id} |
placed_at | timestamptz | |
acked_at | timestamptz | |
last_polled_at | timestamptz | |
last_status | text | |
last_status_payload | jsonb | |
delivered_count | integer | NOT NULL DEFAULT 0 |
ns_verified_at | timestamptz | |
sla_alerted_at | timestamptz | |
escalated_at | timestamptz | |
dry_run | boolean | NOT NULL DEFAULT true |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
infra_vendor_tickets
Defined in: 202609191500_aip_ws2_mailin_vendor_orders.sql
| Column | Type | Constraints |
|---|---|---|
id | serial | PRIMARY KEY |
infrastructure_order_id | integer | REFERENCES public.infrastructure_orders(id) ON DELETE CASCADE |
vendor | text | NOT NULL DEFAULT 'mailin' |
kind | text | NOT NULL CHECK (kind IN ('delivery_overdue','ns_pending','cancel','replace','reconnect','membership_pending')) |
slack_channel | text | |
slack_ts | text | |
opened_at | timestamptz | NOT NULL DEFAULT now() |
last_nag_at | timestamptz | |
nag_count | integer | NOT NULL DEFAULT 0 |
closed_at | timestamptz | |
status | text | NOT NULL DEFAULT 'pending_arm' CHECK (status IN ('pending_arm','open','nagging','closed')) |
detail | jsonb |
infra_sender_moves
Defined in: 202609191500_aip_ws2_mailin_vendor_orders.sql
| Column | Type | Constraints |
|---|---|---|
id | serial | PRIMARY KEY |
infrastructure_order_id | integer | REFERENCES public.infrastructure_orders(id) ON DELETE SET NULL |
bison_instance | text | |
source_workspace | text | NOT NULL |
source_bison_workspace_id | integer | |
target_workspace | text | NOT NULL |
target_bison_workspace_id | integer | |
old_sender_id | integer | NOT NULL |
new_sender_id | integer | |
email | text | |
moved_at | timestamptz | |
verified_at | timestamptz | |
batch_id | text | |
dry_run | boolean | NOT NULL DEFAULT true |
created_at | timestamptz | NOT NULL DEFAULT now() |
infra_credstore_pulls
Defined in: 202609191500_aip_ws2_mailin_vendor_orders.sql
| Column | Type | Constraints |
|---|---|---|
id | serial | PRIMARY KEY |
vendor | text | NOT NULL DEFAULT 'mailin' |
started_at | timestamptz | NOT NULL DEFAULT now() |
finished_at | timestamptz | |
status | text | NOT NULL DEFAULT 'running' CHECK (status IN ('running','ok','skipped_no_key','smoke_ok','error')) |
domains_seen | integer | NOT NULL DEFAULT 0 |
files_written | integer | NOT NULL DEFAULT 0 |
rows_added | integer | NOT NULL DEFAULT 0 |
promoted_incoming | integer | NOT NULL DEFAULT 0 |
error | text | |
dry_run | boolean | NOT NULL DEFAULT true |
infra_pipeline_steps
AIP run ledger (hub §4): one row per pipeline step per sub-order (or per onboarding for human/vendor gates). lane = writing stream; step_key = <lane>.<name> lowercase; status dark = recorded while the flag was off, evidence.would_do says what would have happened. Written only via app/services/pipeline_ledger.record_step. Not the v1 onboarding_steps checklist.
Defined in: 202609200800_aip_ws1_pipeline_ledger.sql
| Column | Type | Constraints |
|---|---|---|
id | bigint | GENERATED ALWAYS AS IDENTITY PRIMARY KEY |
client_onboarding_id | integer | REFERENCES public.client_onboardings(id) ON DELETE SET NULL |
infrastructure_order_id | integer | REFERENCES public.infrastructure_orders(id) ON DELETE CASCADE |
lane | text | NOT NULL CHECK (lane IN ('ws1', 'ws2', 'ws3', 'ws4', 'ws5', 'ws6', 'ws7', 'human', 'vendor')) |
step_key | text | NOT NULL CHECK (step_key ~ '^[a-z0-9_]+.[a-z0-9_]+$') |
status | text | NOT NULL CHECK (status IN ('pending', 'running', 'waiting', 'done', 'failed', 'skipped', 'dark')) |
started_at | timestamptz | |
finished_at | timestamptz | |
waiting_on | text | |
next_action | text | |
owner | text | |
flag_key | text | |
dark | boolean | NOT NULL DEFAULT false |
evidence | jsonb | NOT NULL DEFAULT '{}'::jsonb |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
scope_key | text | GENERATED ALWAYS AS ( |
CASE | WHEN | infrastructure_order_id IS NOT NULL |
domain_purchase_plans
Defined in: 202609200900_aip_ws4_domain_purchase_plans.sql
| Column | Type | Constraints |
|---|---|---|
id | bigserial | PRIMARY KEY |
client_onboarding_id | bigint | NOT NULL |
infrastructure_order_id | bigint | NOT NULL |
provider_key | text | NOT NULL CHECK (provider_key IN ('google_ws','microsoft_365','azure','other')) |
registrar_account_id | integer | REFERENCES public.registrar_accounts(id) |
base_domain | text | NOT NULL |
sending_name | text | |
requested_count | integer | NOT NULL CHECK (requested_count >= 0) |
daily_cap | integer | NOT NULL DEFAULT 10 CHECK (daily_cap BETWEEN 1 AND 100) |
estimated_cost_cents | integer | NOT NULL DEFAULT 0 |
receipt | jsonb | NOT NULL DEFAULT '{}'::jsonb |
planning_complete | boolean | NOT NULL DEFAULT false |
planning_generation | uuid | NOT NULL DEFAULT gen_random_uuid() |
status | text | NOT NULL DEFAULT 'planned' |
max_total_spend_cents | integer | CHECK (max_total_spend_cents > 0) |
max_total_registrations | integer | CHECK (max_total_registrations > 0) |
cancellation_requested_at | timestamptz | |
approved_by | text | |
approved_at | timestamptz | |
last_run_at | timestamptz | |
next_eligible_at | timestamptz | |
consecutive_billing_errors | integer | NOT NULL DEFAULT 0 |
last_error | text | |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
domain_purchase_items
Defined in: 202609200900_aip_ws4_domain_purchase_plans.sql
| Column | Type | Constraints |
|---|---|---|
id | bigserial | PRIMARY KEY |
plan_id | bigint | NOT NULL REFERENCES public.domain_purchase_plans(id) ON DELETE CASCADE |
root | text | NOT NULL UNIQUE |
stem | text | |
is_backup | boolean | NOT NULL DEFAULT false |
status | text | NOT NULL DEFAULT 'candidate' |
deny_reason | text | |
rdap_checked_at | timestamptz | |
rdap_available | boolean | |
availability_checked_at | timestamptz | |
async_operation_id | text | |
planning_generation | uuid | |
submission_id | uuid | UNIQUE |
submitted_at | timestamptz | |
cancellation_requested_at | timestamptz | |
dns_status | text | NOT NULL DEFAULT 'pending' CHECK (dns_status IN ('pending','verified','blocked')) |
dns_dispatched_at | timestamptz | |
dns_last_error | text | |
purchased_at | timestamptz | |
price_cents | integer | |
attempts | integer | NOT NULL DEFAULT 0 |
last_error | text | |
source | text | NOT NULL DEFAULT 'runner' CHECK (source IN ('runner','runner_legacy')) |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
domain_dns_intents
Defined in: 202609200910_aip_ws4_domain_dns_intents.sql
| Column | Type | Constraints |
|---|---|---|
root | text | PRIMARY KEY |
revision | uuid | NOT NULL DEFAULT gen_random_uuid() |
client_onboarding_id | bigint | |
infrastructure_order_id | bigint | |
lane | text | NOT NULL DEFAULT 'other' CHECK (lane IN ('microsoft_365','azure','other')) |
ns_intent | text | NOT NULL DEFAULT 'basic' CHECK (ns_intent IN ('basic','mailin_cf','external')) |
ns_intent_hosts | text[] | |
ns_intent_set_by | text | |
ns_intent_set_at | timestamptz | |
ns_applied_at | timestamptz | |
desired_records | jsonb | NOT NULL DEFAULT '[]'::jsonb |
pending_slots | jsonb | NOT NULL DEFAULT '[]'::jsonb |
forwarding_url | text | |
dkim_tenant_domain | text | |
applied_at | timestamptz | |
verified_at | timestamptz | |
last_probe_at | timestamptz | |
drift | jsonb | NOT NULL DEFAULT '{}'::jsonb |
drift_state | text | NOT NULL DEFAULT 'pending' CHECK (drift_state IN ('pending','ok','drift','unreachable')) |
dbl_listed | boolean | |
dbl_code | text | |
dmarc_present | boolean | |
forward_present | boolean | |
source | text | NOT NULL DEFAULT 'runner' CHECK (source IN ('runner','declared','probe_only')) |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
ms365_provisioning_runs
Defined in: 202609201000_aip_ws3_ms365_provisioning_registry.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
order_id | INTEGER | NOT NULL REFERENCES public.infrastructure_orders(id) ON DELETE CASCADE |
client_onboarding_id | INTEGER | REFERENCES public.client_onboardings(id) ON DELETE SET NULL |
workspace_name | TEXT | |
bison_instance | TEXT | |
bison_workspace_id | INTEGER | |
panel_number | SMALLINT | REFERENCES public.ms365_panels(panel_number) |
status | TEXT | NOT NULL DEFAULT 'planned' |
stage | TEXT | |
blocker | TEXT | |
plan | JSONB | NOT NULL DEFAULT '{}'::jsonb |
domains | JSONB | NOT NULL DEFAULT '[]'::jsonb |
total_accounts | INTEGER | NOT NULL DEFAULT 0 |
accounts_created | INTEGER | NOT NULL DEFAULT 0 |
accounts_connected | INTEGER | NOT NULL DEFAULT 0 |
accounts_postured | INTEGER | NOT NULL DEFAULT 0 |
connect_attempts | INTEGER | NOT NULL DEFAULT 0 |
error_message | TEXT | |
celery_task_id | TEXT | |
planned_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
dns_ready_at | TIMESTAMPTZ | |
domains_verified_at | TIMESTAMPTZ | |
users_created_at | TIMESTAMPTZ | |
aged_ready_at | TIMESTAMPTZ | |
connect_completed_at | TIMESTAMPTZ | |
posture_verified_at | TIMESTAMPTZ | |
dkim_at | TIMESTAMPTZ | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
ms365_provisioning_run_logs
Defined in: 202609201000_aip_ws3_ms365_provisioning_registry.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
run_id | BIGINT | REFERENCES public.ms365_provisioning_runs(id) ON DELETE CASCADE |
panel_number | SMALLINT | |
step | TEXT | NOT NULL |
status | TEXT | NOT NULL |
message | TEXT | |
payload | JSONB | NOT NULL DEFAULT '{}'::jsonb |
logged_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
ms365_seat_reservations
Defined in: 202609201000_aip_ws3_ms365_provisioning_registry.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
run_id | BIGINT | REFERENCES public.ms365_provisioning_runs(id) ON DELETE CASCADE |
order_id | INTEGER | NOT NULL REFERENCES public.infrastructure_orders(id) ON DELETE CASCADE |
panel_number | SMALLINT | NOT NULL REFERENCES public.ms365_panels(panel_number) |
seats | INTEGER | NOT NULL CHECK (seats >= 0) |
domain_slots | INTEGER | NOT NULL CHECK (domain_slots >= 0) |
status | TEXT | NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'consumed', 'released')) |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
expires_at | TIMESTAMPTZ | NOT NULL |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
ms365_recon_findings
Defined in: 202609201000_aip_ws3_ms365_provisioning_registry.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
panel_number | SMALLINT | REFERENCES public.ms365_panels(panel_number) |
run_id | BIGINT | REFERENCES public.ms365_provisioning_runs(id) ON DELETE SET NULL |
workspace_name | TEXT | |
email_address | TEXT | |
kind | TEXT | NOT NULL |
detail | JSONB | NOT NULL DEFAULT '{}'::jsonb |
status | TEXT | NOT NULL DEFAULT 'open' CHECK (status IN ('open', 'resolved', 'dismissed')) |
first_seen_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
last_seen_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
resolved_at | TIMESTAMPTZ | |
resolved_by | TEXT |
ms365_domain_tenants
*Sending domain -> Microsoft tenant, resolved from the public OpenID issuer *
Defined in: 202609212200_ms365_panel_tags.sql
| Column | Type | Constraints |
|---|---|---|
domain | text | PRIMARY KEY |
tenant_id | uuid | |
panel_number | integer | |
resolved_at | timestamptz | NOT NULL DEFAULT now() |
source | text | NOT NULL CHECK (source IN ('openid', 'graph')) |
error | text |
ms365_panel_tag_runs
*One row per ms365_panel_tags.run. mode dry_run = plan only, no Bison or *
Defined in: 202609212200_ms365_panel_tags.sql
| Column | Type | Constraints |
|---|---|---|
id | bigserial | PRIMARY KEY |
started_at | timestamptz | NOT NULL DEFAULT now() |
finished_at | timestamptz | |
mode | text | NOT NULL CHECK (mode IN ('dry_run', 'apply')) |
armed | boolean | NOT NULL DEFAULT false |
scope | jsonb | NOT NULL DEFAULT '{}'::jsonb |
counts | jsonb | NOT NULL DEFAULT '{}'::jsonb |
per_workspace | jsonb | NOT NULL DEFAULT '{}'::jsonb |
per_panel | jsonb | NOT NULL DEFAULT '{}'::jsonb |
unresolved | jsonb | NOT NULL DEFAULT '[]'::jsonb |
errors | jsonb | NOT NULL DEFAULT '[]'::jsonb |
created_by | text |
domain_root_assignments
Defined in: 202609212300_aip_ws4_assignment_recovery.sql
| Column | Type | Constraints |
|---|---|---|
root | text | PRIMARY KEY CHECK (root = lower(root) AND root ~ '^a-z0-9?.[a-z]{2,63}$') |
client_onboarding_id | integer | NOT NULL REFERENCES public.client_onboardings(id) |
infrastructure_order_id | integer | NOT NULL REFERENCES public.infrastructure_orders(id) |
registrar_account_id | integer | NOT NULL REFERENCES public.registrar_accounts(id) |
source | text | NOT NULL CHECK (source IN ('runner','operator')) |
assigned_by | text | NOT NULL CHECK (length(assigned_by) > 0) |
assigned_at | timestamptz | NOT NULL DEFAULT now() |
infra_ws2_canary_policies
Defined in: 20260922041636_aip_ws2_canary_reservations.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
enabled | boolean | NOT NULL DEFAULT false |
expires_at | timestamptz | NOT NULL |
currency | text | NOT NULL CHECK (currency ~ '^[A-Z]{3}$') |
approved_by | text | NOT NULL CHECK (length(trim(approved_by)) > 0) |
lifetime_mutations | bigint | NOT NULL CHECK (lifetime_mutations >= 0) |
daily_mutations | bigint | NOT NULL CHECK (daily_mutations >= 0) |
lifetime_spend_minor | bigint | NOT NULL CHECK (lifetime_spend_minor >= 0) |
daily_spend_minor | bigint | NOT NULL CHECK (daily_spend_minor >= 0) |
created_at | timestamptz | NOT NULL DEFAULT now() |
infra_ws2_canary_scopes
Defined in: 20260922041636_aip_ws2_canary_reservations.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
policy_id | uuid | NOT NULL REFERENCES public.infra_ws2_canary_policies(id) |
action | text | NOT NULL CHECK (action IN ('placement', 'staging_move')) |
infrastructure_order_id | integer | NOT NULL REFERENCES public.infrastructure_orders(id) |
root | text | NOT NULL CHECK (root = lower(trim(root)) AND root ~ '^[a-z0-9][a-z0-9.-]*[a-z0-9]$') |
destination_workspace | text | NOT NULL CHECK (length(trim(destination_workspace)) > 0) |
destination_bison_workspace_id | integer | NOT NULL CHECK (destination_bison_workspace_id > 0) |
bison_instance | text | NOT NULL CHECK (length(trim(bison_instance)) > 0) |
price_per_mutation_minor | numeric(20,6) | CHECK ( |
expires_at | timestamptz | NOT NULL |
infra_ws2_canary_reservations
Defined in: 20260922041636_aip_ws2_canary_reservations.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
reservation_id | uuid | NOT NULL |
policy_id | uuid | NOT NULL REFERENCES public.infra_ws2_canary_policies(id) |
scope_id | uuid | NOT NULL REFERENCES public.infra_ws2_canary_scopes(id) |
action | text | NOT NULL CHECK (action IN ('placement', 'staging_move')) |
identity | text | NOT NULL |
bison_instance | text | NOT NULL |
mutations | bigint | NOT NULL CHECK (mutations > 0) |
spend_minor | bigint | NOT NULL CHECK (spend_minor >= 0) |
reserved_at | timestamptz | NOT NULL DEFAULT clock_timestamp() |
receipt | jsonb | |
receipt_at | timestamptz | |
intent | jsonb | |
recovery_checked_at | timestamptz | |
recovery_complete | boolean | NOT NULL DEFAULT false |
infra_pipeline_step_observations
AIP immutable run/attempt snapshots from the projection transaction or explicit program/flag events. No backfill and no subject FK: past identities survive subject removal. Read acceptance history here, not from the latest-state projection.
Defined in: 202609220500_aip_ws1_observation_history.sql
| Column | Type | Constraints |
|---|---|---|
id | bigint | GENERATED ALWAYS AS IDENTITY PRIMARY KEY |
observation_id | uuid | NOT NULL UNIQUE |
run_id | text | NOT NULL CHECK (btrim(run_id) <> '') |
attempt | integer | NOT NULL CHECK (attempt >= 0) |
scope_key | text | NOT NULL |
program_scope | text | |
infrastructure_order_id | integer | |
client_onboarding_id | integer | |
lane | text | NOT NULL CHECK (lane IN ('ws1', 'ws2', 'ws3', 'ws4', 'ws5', 'ws6', 'ws7', 'human', 'vendor')) |
step_key | text | NOT NULL CHECK (step_key ~ '^[a-z0-9_]+.[a-z0-9_]+$') |
status | text | NOT NULL CHECK (status IN ('pending', 'running', 'waiting', 'done', 'failed', 'skipped', 'dark')) |
flag_key | text | |
dark | boolean | NOT NULL DEFAULT false |
evidence | jsonb | NOT NULL DEFAULT '{}'::jsonb |
started_at | timestamptz | |
finished_at | timestamptz | |
waiting_on | text | |
next_action | text | |
owner | text | |
observed_at | timestamptz | NOT NULL DEFAULT clock_timestamp() |
AND | scope_key | = 'order:' || infrastructure_order_id::text) |
AND | program_scope | IS NULL AND scope_key = 'onboarding:' || client_onboarding_id::text) |
AND | program_scope | IS NOT NULL AND program_scope ~ '^[a-z][a-z0-9_-]*$' |
AND | flag_key | IS NOT NULL AND btrim(flag_key) <> '' |
AND | scope_key | = 'program:' || program_scope || ':flag:' || flag_key) |
bounce_digest_events
Durable metadata-only bounce notification receipts. Acknowledgement is Slack delivery state, not business state. Keep acknowledged keys to suppress future webhook retries; no raw DSN/payload is stored.
Defined in: 20260922142229_bounce_digest_receipts.sql
| Column | Type | Constraints |
|---|---|---|
event_key | text | PRIMARY KEY CHECK (event_key ~ '^[0-9a-f]{32}$') |
workspace_name | text | NOT NULL |
workspace_id | bigint | |
instance_url | text | |
sender_email_id | bigint | |
sender_email | text | NOT NULL |
root_domain | text | NOT NULL |
is_quota | boolean | NOT NULL |
source_received_at | timestamptz | NOT NULL |
processed_at | timestamptz | NOT NULL DEFAULT clock_timestamp() |
acknowledged_at | timestamptz |
warmup_gate_snapshots
Defined in: 20260922155704_aip_ws5_warmup_gate.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
order_id | INTEGER | NOT NULL REFERENCES public.infrastructure_orders(id) ON DELETE CASCADE |
snapshot_date | DATE | NOT NULL |
linked_count | INTEGER | NOT NULL DEFAULT 0 CHECK (linked_count >= 0) |
connected_count | INTEGER | NOT NULL DEFAULT 0 CHECK (connected_count >= 0) |
warmup_on_count | INTEGER | NOT NULL DEFAULT 0 CHECK (warmup_on_count >= 0) |
scored_count | INTEGER | NOT NULL DEFAULT 0 CHECK (scored_count >= 0) |
avg_score | NUMERIC(6,2) | CHECK (avg_score BETWEEN 0 AND 100) |
pct_warm_on | NUMERIC(5,4) | CHECK (pct_warm_on BETWEEN 0 AND 1) |
pct_score_ok | NUMERIC(5,4) | CHECK (pct_score_ok BETWEEN 0 AND 1) |
days_warming | INTEGER | NOT NULL DEFAULT 0 CHECK (days_warming >= 0) |
decision | TEXT | NOT NULL CHECK (decision IN ('immature', 'matured_evidence', 'matured_calendar', 'held')) |
hold_reason | TEXT | |
error | TEXT | |
params | JSONB | NOT NULL DEFAULT '{}'::jsonb CHECK (jsonb_typeof(params) = 'object') |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
mailbox_limit_ledger
Every change to a mailbox
Defined in: 202609240800_panel_cap_ramp.sql
| Column | Type | Constraints |
|---|---|---|
id | bigserial | PRIMARY KEY |
at | timestamptz | NOT NULL DEFAULT now() |
bison_sender_email_id | integer | |
email_address | text | |
workspace_name | text | |
ms365_panel | smallint | |
kind | text | NOT NULL CHECK (kind IN ('campaign', 'warmup')) |
before | integer | |
after | integer | |
source | text | NOT NULL CHECK (source IN ('plan', 'plan_dry', 'manual', 'observed', 'rollback')) |
reason | text | |
run_id | text | |
actor | text | |
override_until | timestamptz | |
note | text |
panel_budget_snapshots
The panel-cap ramp
Defined in: 202609240800_panel_cap_ramp.sql
| Column | Type | Constraints |
|---|---|---|
id | bigserial | PRIMARY KEY |
panel_number | smallint | NOT NULL |
run_at | timestamptz | NOT NULL DEFAULT now() |
run_id | text | |
mode | text | NOT NULL CHECK (mode IN ('dark', 'dry_run', 'live')) |
status | text | NOT NULL CHECK (status IN ('planned', 'unmeasured', 'no_boxes', 'no_tier')) |
cap | integer | |
margin | numeric(4, | 3) |
budget_total | integer | |
boxes | integer | NOT NULL DEFAULT 0 |
per_box_budget | integer | |
seat_band | text | |
tier_pct | smallint | |
fits_minimum | boolean | NOT NULL DEFAULT false |
campaign_total | integer | NOT NULL DEFAULT 0 |
warmup_total | integer | NOT NULL DEFAULT 0 |
raises | integer | NOT NULL DEFAULT 0 |
clamps | integer | NOT NULL DEFAULT 0 |
writes | integer | NOT NULL DEFAULT 0 |
observed | integer | |
detail | jsonb | NOT NULL DEFAULT '{}'::jsonb |
task_evidence
One row per (task, evidence item) the reconciler judged; applied=false rows are the shadow-mode measurement set.
Defined in: 202609240900_task_reconciler.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
run_date | date | NOT NULL |
person_id | uuid | REFERENCES public.user_profiles(id) ON DELETE SET NULL |
task_id | uuid | REFERENCES public.tasks(id) ON DELETE CASCADE |
kind | text | NOT NULL CHECK (kind IN ('pr', 'commit', 'digest', 'slack')) |
ref | text | NOT NULL |
excerpt | text | |
occurred_at | timestamptz | |
verdict | text | CHECK (verdict IN ('done', 'progress', 'blocked', 'none')) |
confidence | numeric | |
quote | text | |
hard | boolean | NOT NULL DEFAULT false |
applied | boolean | NOT NULL DEFAULT false |
applied_action | text | |
created_at | timestamptz | NOT NULL DEFAULT now() |
client_call_notes
What a client asked for on a call, structured, so the work can be handed to anyone.
Defined in: 202609240930_task_context_outbox.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
meeting | text | NOT NULL |
call_date | date | NOT NULL |
client_name | text | |
agency | text | |
workspace_hint | text | |
contact_name | text | |
attendees | jsonb | NOT NULL DEFAULT '[]'::jsonb |
requests | jsonb | NOT NULL DEFAULT '[]'::jsonb, -- [{ask, quote, owner_hint}] |
facts | jsonb | NOT NULL DEFAULT '[]'::jsonb, -- [{topic, value, quote}] |
decisions | jsonb | NOT NULL DEFAULT '[]'::jsonb |
next_steps | jsonb | NOT NULL DEFAULT '[]'::jsonb |
batch_id | uuid | REFERENCES public.task_proposal_batches(id) ON DELETE SET NULL |
created_by | uuid | REFERENCES public.user_profiles(id) |
created_at | timestamptz | NOT NULL DEFAULT now() |
vault_outbox
Notes the platform wants in the team vault; flushed by vault_writer through the GitHub API.
Defined in: 202609240930_task_context_outbox.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
path | text | NOT NULL |
mode | text | NOT NULL CHECK (mode IN ('append', 'replace')) |
section | text, | -- append: a marker line; present in the file means already written |
content | text | NOT NULL |
status | text | NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'done', 'failed', 'skipped')) |
error | text | |
created_at | timestamptz | NOT NULL DEFAULT now() |
applied_at | timestamptz |
meeting_schedule
Defined in: 202609241000_meeting_schedule.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
event_id | text | NOT NULL |
calendar | text | NOT NULL, -- the mailbox whose calendar it came from |
title | text | NOT NULL |
starts_at | timestamptz | NOT NULL |
ends_at | timestamptz | NOT NULL |
attendees | jsonb | NOT NULL DEFAULT '[]'::jsonb |
external | boolean | NOT NULL DEFAULT false |
profile | text | NOT NULL, -- team | client_onboarding | client | exec | skip |
label | text | NOT NULL, -- the meeting label the notes mail will carry |
status | text | NOT NULL DEFAULT 'scheduled' CHECK (status IN ('scheduled', 'ingested', 'no_notes', 'skipped', 'failed')) |
attempts | int | NOT NULL DEFAULT 0 |
detail | text | |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
work_ownership_rules
Who owns a task. Evaluate enabled rules of the asked scope_kind by ordinal ascending; the LAST match wins. scope_kind=default is the fallback: keep exactly one enabled default row (documented, not enforced by trigger). Seeded by work_ownership.seed_rules; hand-edited rows keep a note that does not start with "seed:" so the seeder leaves them alone.
Defined in: 202609241300_work_foundations.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
ordinal | integer | NOT NULL DEFAULT 100 |
scope_kind | text | NOT NULL |
pattern | text | NOT NULL |
owner_profile_id | uuid | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
owner_role | text | NULL |
note | text | NULL |
enabled | boolean | NOT NULL DEFAULT true |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
work_rules
One row per automated rule with its mode. off: do nothing. shadow: compute and record what would happen, send nothing. suggest: ask a human (buttons/DM). apply: act. Read through work_rules.get_rule (60 s cache); a missing row reads as shadow.
Defined in: 202609241300_work_foundations.sql
| Column | Type | Constraints |
|---|---|---|
rule_key | text | PRIMARY KEY |
mode | text | NOT NULL DEFAULT 'shadow' |
params | jsonb | NOT NULL DEFAULT '{}'::jsonb |
description | text | NULL |
updated_at | timestamptz | NOT NULL DEFAULT now() |
work_rule_overrides
A human undid or corrected what a rule did (or, in shadow/suggest, what it proposed). Override rate per rule = rows here / rule applications (task_timeline rows whose payload carries the rule_key) over a window; see work_rules.override_rate.
Defined in: 202609241300_work_foundations.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
rule_key | text | NOT NULL REFERENCES public.work_rules(rule_key) ON DELETE CASCADE |
task_id | uuid | NULL REFERENCES public.tasks(id) ON DELETE SET NULL |
evidence_refs | jsonb | NOT NULL DEFAULT '[]'::jsonb |
before | jsonb | NULL |
after | jsonb | NULL |
actor_id | uuid | NULL REFERENCES public.user_profiles(id) ON DELETE SET NULL |
reason | text | NULL |
source | text | NOT NULL DEFAULT 'system' |
created_at | timestamptz | NOT NULL DEFAULT now() |
work_entity_disagreements
Two sources disagree about an entity (e.g. Clients/anna-luna-agency.md says workspace 61, its ops note says platform_workspace_id 43). The seed job records the conflict here and picks nothing; a human resolves it.
Defined in: 202609241300_work_foundations.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
entity_type | text | NOT NULL |
canonical_name | text | NOT NULL |
field | text | NOT NULL |
status | text | NOT NULL DEFAULT 'open' |
created_at | timestamptz | NOT NULL DEFAULT now() |
work_findings_config
One row per audit check key (audit_findings.check_key) or MCP finding class (mcp:<finding_class>). enabled=false means the finding is scored in work_findings_log but never becomes a task.
Defined in: 202609241400_work_items.sql
| Column | Type | Constraints |
|---|---|---|
check_key | text | PRIMARY KEY |
source | text | NOT NULL CHECK (source IN ('audit_findings', 'mcp_audit_findings')) |
enabled | boolean | NOT NULL DEFAULT false |
severity_floor | text | NOT NULL DEFAULT 'warn' CHECK (severity_floor IN ('info', 'warn', 'high')) |
hold_cycles | integer | NOT NULL DEFAULT 1 |
resolve_window_runs | integer | NOT NULL DEFAULT 2 |
owner_scope_kind | text | NOT NULL DEFAULT 'check_key' |
fallback_owner_role | text | |
next_action | text | |
note | text | |
updated_at | timestamptz | NOT NULL DEFAULT now() |
work_findings_log
What findings.sync decided per finding per run. In shadow mode this is the whole output; in apply mode task_id points at the item touched.
Defined in: 202609241400_work_items.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
run_date | date | NOT NULL |
check_key | text | NOT NULL |
workspace_name | text | |
fingerprint | text | NOT NULL |
action | text | NOT NULL CHECK (action IN ( |
task_id | uuid | REFERENCES public.tasks(id) ON DELETE SET NULL |
detail | jsonb | NOT NULL DEFAULT '{}'::jsonb |
created_at | timestamptz | NOT NULL DEFAULT now() |
llm_traces
One row per LLM call in the task pipeline: what went in (ids only), what came out, how sure it was, what was done with it, and what a human said afterwards.
Defined in: 202609241430_llm_traces.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
call_kind | text | NOT NULL |
model | text | |
prompt_hash | text | |
schema_version | text | |
input_ids | jsonb | NOT NULL DEFAULT '{}'::jsonb |
output | jsonb | |
confidence | numeric | |
decision | text | CHECK (decision IS NULL OR decision IN ('auto', 'ask', 'skip', 'none')) |
human_outcome | text | |
usage | jsonb | |
latency_ms | int | |
error | text | |
created_at | timestamptz | NOT NULL DEFAULT now() |
brain_notes
One row per team-vault note the brain index knows; path is the vault-relative markdown path. deleted_at set (not removed) when the note leaves the vault or becomes excluded.
Defined in: 202609241500_brain_index.sql
| Column | Type | Constraints |
|---|---|---|
path | text | PRIMARY KEY |
title | text | NOT NULL |
doc_type | text | |
status | text | |
owner | text | |
tags | text[] | NOT NULL DEFAULT '{}'::text[] |
aliases | text[] | NOT NULL DEFAULT '{}'::text[] |
client_key | text | |
workspace_ids | jsonb | NOT NULL DEFAULT '{}'::jsonb |
frontmatter | jsonb | NOT NULL DEFAULT '{}'::jsonb |
summary | text | |
content_hash | text | NOT NULL |
commit_sha | text | |
indexed_at | timestamptz | NOT NULL DEFAULT now() |
deleted_at | timestamptz |
brain_chunks
Retrieval units of the brain index: one per H2/H3 section (split further near 300 tokens). tsv is generated from prefix + body; embedding is NULL until an embedder writes it.
Defined in: 202609241500_brain_index.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
note_path | text | NOT NULL REFERENCES public.brain_notes(path) ON DELETE CASCADE |
heading | text | NOT NULL DEFAULT '' |
ordinal | integer | NOT NULL |
prefix | text | |
body | text | NOT NULL |
tokens | integer | NOT NULL DEFAULT 0 |
content_hash | text | NOT NULL |
tsv | tsvector | GENERATED ALWAYS AS (to_tsvector('english', coalesce(prefix, '') || ' ' || body)) STORED |
embedding | vector(1024) | |
commit_sha | text | |
created_at | timestamptz | NOT NULL DEFAULT now() |
brain_links
Wikilinks between notes. to_path is the resolved vault path when the target is indexed, else the raw link target (unresolved links are kept so they resolve on a later run).
Defined in: 202609241500_brain_index.sql
| Column | Type | Constraints |
|---|---|---|
from_path | text | NOT NULL REFERENCES public.brain_notes(path) ON DELETE CASCADE |
to_path | text | NOT NULL |
to_title | text | |
kind | text | NOT NULL DEFAULT 'wikilink' |
brain_index_state
Single row (id = 1): which vault (repo or local dir), the last commit indexed, when, and the live note/chunk counts. The incremental indexer diffs from last_commit_sha.
Defined in: 202609241500_brain_index.sql
| Column | Type | Constraints |
|---|---|---|
id | integer | PRIMARY KEY DEFAULT 1 CHECK (id = 1) |
repo | text | |
last_commit_sha | text | |
last_run_at | timestamptz | |
notes | integer | NOT NULL DEFAULT 0 |
chunks | integer | NOT NULL DEFAULT 0 |
work_handoffs
Every report-thread reply the hand-off intake judged; action=create rows carry the task in apply mode, or what would have been created in shadow.
Defined in: 202609241530_work_handoffs.sql
| Column | Type | Constraints |
|---|---|---|
fingerprint | text | PRIMARY KEY, -- slack:<channel>:<message_ts> |
channel_id | text | NOT NULL |
thread_ts | text | NOT NULL |
message_ts | text | NOT NULL |
permalink | text | |
requester_id | uuid | REFERENCES public.user_profiles(id) ON DELETE SET NULL |
owner_id | uuid | REFERENCES public.user_profiles(id) ON DELETE SET NULL |
collaborator_ids | uuid[] | NOT NULL DEFAULT '{}' |
title | text | |
action | text | NOT NULL CHECK (action IN ('create','skip_no_mention','skip_not_team','skip_ack','skip_question','skip_channel','noop','error')) |
mode | text | NOT NULL, -- work_rules mode at the time: shadow | apply |
task_id | uuid | REFERENCES public.tasks(id) ON DELETE SET NULL |
detail | jsonb | NOT NULL DEFAULT '{}'::jsonb |
created_at | timestamptz | NOT NULL DEFAULT now() |
lead_loss_checks
Defined in: 202609250800_lead_loss_checks.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
lead_reply_id | uuid | NOT NULL UNIQUE, -- lead_replies.id of the reply in question |
workspace_name | text | NOT NULL |
lead_email | text | NOT NULL |
first_name | text | |
reply_date | timestamptz | |
reply_text | text | |
source | text | NOT NULL, -- gate_said_lead | nurtured_not_billed | rejected_then_wrote_again | followup_unclassified | question_not_nurtured |
score | smallint | NOT NULL DEFAULT 0, -- 0..99, likelihood the lead was lost |
evidence | jsonb | NOT NULL DEFAULT '{}'::jsonb, -- {gate_confidence, gate_intent, nurture_intent, nurture_confidence, our_action, later_replies, later_interested, bison_folder, bison_interested, ...} |
status | text | NOT NULL DEFAULT 'open', -- open | lost | dismissed | resolved |
resolution | text, | -- for resolved: marked as lead | deleted in Bison | marked not interested in Bison |
decided_by | text | |
decided_at | timestamptz | |
note | text | |
bison_url | text | |
first_seen_at | timestamptz | NOT NULL DEFAULT now() |
checked_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
exec_briefs
One row per executive-brief run (shadow or apply). The brief is about day; facts is everything the collectors found with baselines, attribution and context; judgments the model
Defined in: 202609251200_exec_briefs.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
day | date | NOT NULL |
window_start | timestamptz | |
window_end | timestamptz | |
facts | jsonb | NOT NULL DEFAULT '{}'::jsonb |
lines | jsonb | NOT NULL DEFAULT '[]'::jsonb |
judgments | jsonb | NOT NULL DEFAULT '[]'::jsonb |
dropped | jsonb | NOT NULL DEFAULT '[]'::jsonb |
reasoning | text | |
text | text | |
model | text | |
trace_id | uuid | NULL |
mode | text | NOT NULL |
sent_to | text[] | DEFAULT '{}' |
sent_at | timestamptz | NULL |
empty | boolean | NOT NULL DEFAULT false |
created_at | timestamptz | DEFAULT now() |
exec_brief_state
Single-row memory for the executive brief: the MS365 panel values seen on the previous run, so the next run reports only panels whose TERRL verdict or plan status changed.
Defined in: 202609251200_exec_briefs.sql
| Column | Type | Constraints |
|---|---|---|
id | int | PRIMARY KEY DEFAULT 1 |
last_panel_state | jsonb | DEFAULT '{}'::jsonb |
last_day | date |
exec_brief_feedback
What Tommy or Ray said about one line of one brief. The last 30 rows are shown to the model on every run ("what the readers said about earlier lines"), so the brief improves from corrections without a code change.
Defined in: 202609251200_exec_briefs.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
brief_id | uuid | NOT NULL REFERENCES public.exec_briefs(id) ON DELETE CASCADE |
line_index | int | NOT NULL |
verdict | text | NOT NULL CHECK (verdict IN ('useful', 'noise', 'wrong')) |
note | text | |
created_by | text | |
created_at | timestamptz | NOT NULL DEFAULT now() |
domain_purchase_operator_attempts
Defined in: 20260925215015_aip_ws4_operator_mcp_claim.sql
| Column | Type | Constraints |
|---|---|---|
submission_id | uuid | PRIMARY KEY REFERENCES public.domain_purchase_items(submission_id) |
item_id | bigint | NOT NULL UNIQUE REFERENCES public.domain_purchase_items(id) |
plan_id | bigint | NOT NULL REFERENCES public.domain_purchase_plans(id) |
planning_generation | uuid | NOT NULL |
onboarding_id | integer | NOT NULL REFERENCES public.client_onboardings(id) |
order_id | integer | NOT NULL REFERENCES public.infrastructure_orders(id) |
account_id | integer | NOT NULL CHECK (account_id=1) |
root | text | NOT NULL CHECK (root='schmitzbenefitsagency.com') |
price_cents | integer | NOT NULL CHECK (price_cents=908) |
spend_cap_cents | integer | NOT NULL CHECK (spend_cap_cents=908) |
registration_cap | integer | NOT NULL CHECK (registration_cap=1) |
terms | jsonb | NOT NULL |
args_fingerprint | text | NOT NULL CHECK (args_fingerprint ~ '^[0-9a-f]{64}$') |
payment_fingerprint | text | NOT NULL CHECK (payment_fingerprint ~ '^[0-9a-f]{64}$') |
token_digest | text | NOT NULL CHECK (token_digest ~ '^[0-9a-f]{64}$') |
preview_observed_at | timestamptz | NOT NULL |
preview_expires_at | timestamptz | |
absent_checked_at | timestamptz | NOT NULL |
operator_id | text | NOT NULL CHECK (length(operator_id)>0) |
approval_reference | text | NOT NULL CHECK (length(approval_reference)>=8) |
claimed_at | timestamptz | NOT NULL DEFAULT now() |
state | text | NOT NULL DEFAULT 'claimed' CHECK (state IN |
operation_id | text | UNIQUE |
no_charge_status | text | |
evidence | jsonb | |
settled_at | timestamptz | |
updated_at | timestamptz | NOT NULL DEFAULT now() |
infra_mailin_destination_bindings
Owned Mailin provider creation intent. No API keys; creating is permanently reconcile-only after initial INSERT.
Defined in: 202609270130_mailin_destination_bindings.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
infrastructure_order_id | integer | NOT NULL UNIQUE REFERENCES public.infrastructure_orders(id) |
destination_workspace | text | NOT NULL |
destination_bison_workspace_id | integer | NOT NULL CHECK (destination_bison_workspace_id > 0) |
bison_instance | text | NOT NULL |
instance_url | text | NOT NULL |
registry_workspace_id | integer | NOT NULL |
token_id | integer | NOT NULL |
token_sha256 | text | NOT NULL CHECK (token_sha256 ~ '^[0-9a-f]{64}$') |
persona | text | NOT NULL CHECK (length(trim(persona)) > 0) |
provider_name | text | NOT NULL UNIQUE |
provider_id | integer | UNIQUE CHECK (provider_id > 0) |
status | text | NOT NULL DEFAULT 'creating' CHECK (status IN ('creating', 'ready')) |
created_at | timestamptz | NOT NULL DEFAULT now() |
verified_at | timestamptz |
domain_purchase_operator_expansions
Tony personal ws41/Maverick only; account1; config7 legacy_panel; Sarah Schmitz; one root and30 MS365 accounts per order. All claim attempts permanently consume caps.
Defined in: 20260927014309_aip_ws4_operator_expansions.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY DEFAULT gen_random_uuid() |
roots | text[] | NOT NULL CHECK (aip_ws4_operator_roots_valid(roots)) |
max_total_registrations | integer | NOT NULL CHECK (max_total_registrations BETWEEN 1 AND cardinality(roots)) |
max_total_spend_cents | integer | NOT NULL CHECK (max_total_spend_cents BETWEEN 908 AND 9080) |
quote | jsonb | NOT NULL CHECK (aip_ws4_operator_terms_valid(quote)) |
expires_at | timestamptz | NOT NULL |
approved_by | text | NOT NULL CHECK (length(trim(approved_by))>0) |
approval_reference | text | NOT NULL UNIQUE CHECK (length(trim(approval_reference)) BETWEEN 8 AND 200) |
approved_at | timestamptz | NOT NULL DEFAULT clock_timestamp() |
domain_purchase_operator_expansion_bindings
Defined in: 20260927014309_aip_ws4_operator_expansions.sql
| Column | Type | Constraints |
|---|---|---|
plan_id | bigint | PRIMARY KEY REFERENCES public.domain_purchase_plans(id) |
expansion_id | uuid | NOT NULL REFERENCES public.domain_purchase_operator_expansions(id) |
item_id | bigint | NOT NULL UNIQUE REFERENCES public.domain_purchase_items(id) |
root | text | NOT NULL UNIQUE |
onboarding_id | integer | NOT NULL REFERENCES public.client_onboardings(id) |
order_id | integer | NOT NULL UNIQUE REFERENCES public.infrastructure_orders(id) |
planning_generation | uuid | NOT NULL |
bound_at | timestamptz | NOT NULL DEFAULT clock_timestamp() |
infra_ws2_canary_revocations
Defined in: 20260927182518_mailin_pilot_approval.sql
| Column | Type | Constraints |
|---|---|---|
policy_id | uuid | PRIMARY KEY REFERENCES public.infra_ws2_canary_policies(id) |
revoked_by | text | NOT NULL CHECK (length(trim(revoked_by)) > 0) |
reason_reference | text | NOT NULL CHECK (length(trim(reason_reference)) BETWEEN 1 AND 500) |
revoked_at | timestamptz | NOT NULL DEFAULT clock_timestamp() |
ms365_pilot_delivery_receipts
Defined in: 20260928000001_ms365_pilot_delivery.sql
| Column | Type | Constraints |
|---|---|---|
run_id | bigint | PRIMARY KEY REFERENCES public.ms365_provisioning_runs(id) |
order_id | integer | NOT NULL UNIQUE REFERENCES public.infrastructure_orders(id) |
receipt | jsonb | NOT NULL |
verified_at | timestamptz | NOT NULL |
actor | text | NOT NULL CHECK(length(trim(actor)) > 0) |
created_at | timestamptz | NOT NULL DEFAULT clock_timestamp() |
domain_owned_root_adoptions
Defined in: 20260928040000_ms365_child_units_owned_roots.sql
| Column | Type | Constraints |
|---|---|---|
id | bigserial | PRIMARY KEY |
root | text | NOT NULL CHECK (root = lower(root) AND root ~ '^a-z0-9?.[a-z]{2,63}$') |
registrar_account_id | integer | NOT NULL REFERENCES public.registrar_accounts(id) |
infrastructure_order_id | integer | NOT NULL REFERENCES public.infrastructure_orders(id) |
client_onboarding_id | bigint | NOT NULL |
parent_order_id | integer | REFERENCES public.infrastructure_orders(id) |
provider_key | text | NOT NULL DEFAULT 'microsoft_365' CHECK (provider_key = 'microsoft_365') |
registration_date | date | NOT NULL |
expiration_date | date | |
registrar_status | text | NOT NULL CHECK (registrar_status = 'registered') |
receipt_reference | text | NOT NULL CHECK (length(trim(receipt_reference)) > 0) |
evidence | jsonb | NOT NULL |
adopted_by | text | NOT NULL CHECK (length(trim(adopted_by)) > 0) |
adopted_at | timestamptz | NOT NULL DEFAULT clock_timestamp() |
revoked_at | timestamptz | |
revoked_reason | text |
bison_change_log
Observed Bison changes (campaign state, leads, sends; account connection events). Written by the hourly campaign sync and the account webhooks. No actor: Bison does not expose one.
Defined in: 202609282100_bison_change_log.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
observed_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
day | DATE | NOT NULL, -- Chicago day of observed_at, set by the writer |
workspace_name | TEXT | NOT NULL |
entity_type | TEXT | NOT NULL CHECK (entity_type IN ('campaign', 'account')) |
entity_id | TEXT | NOT NULL, -- Bison campaign id or sender email id |
entity_name | TEXT, | -- campaign name or mailbox address |
change | TEXT | NOT NULL, -- campaign_created, campaign_launched, campaign_resumed, campaign_paused |
delta | INTEGER, | -- leads added / emails sent since the previous observation |
before | JSONB | |
after | JSONB | |
source | TEXT | NOT NULL CHECK (source IN ('campaign_sync', 'webhook', 'snapshot')) |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
runtime_policies
Editable automation guidance text (Settings > Automation); code defaults in app/core/runtime_policy.py
Defined in: 202609291700_runtime_policies.sql
| Column | Type | Constraints |
|---|---|---|
key | TEXT | PRIMARY KEY |
title | TEXT | NOT NULL |
text | TEXT | NOT NULL |
updated_by | TEXT | |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
panel_plan_reviews
Apply / Skip decisions on the ramp executor plan per panel per run (Panels tab readout, 2026-09-30)
Defined in: 202609300745_panel_plan_reviews.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
run_id | TEXT | NOT NULL |
panel_number | INTEGER | NOT NULL |
decision | TEXT | NOT NULL CHECK (decision IN ('apply', 'skip')) |
note | TEXT | |
decided_by | TEXT | |
decided_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
applied_run_id | TEXT | |
result | JSONB |
lead_claim_config
Defined in: 202609301600_lead_claim_sync.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL UNIQUE |
mode | TEXT | NOT NULL DEFAULT 'off' CHECK (mode IN ('off', 'shadow', 'on')) |
policy | TEXT | NOT NULL DEFAULT 'first_reply' CHECK (policy IN ('first_reply', 'round_robin')) |
accept_window_minutes | INTEGER | NOT NULL DEFAULT 30 |
max_rotation_hops | INTEGER | NOT NULL DEFAULT 2 |
rotation_cursor | INTEGER | NOT NULL DEFAULT 0 |
contention_window_seconds | INTEGER | NOT NULL DEFAULT 600 |
slack_channel_id | TEXT | |
producers | JSONB | NOT NULL DEFAULT '[]' |
admin_slack_user_ids | JSONB | NOT NULL DEFAULT '[]' |
max_reply_age_hours | INTEGER | NOT NULL DEFAULT 72 |
display_timezone | TEXT | NOT NULL DEFAULT 'America/Los_Angeles' |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
lead_owners
Defined in: 202609301600_lead_claim_sync.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | NOT NULL |
status | TEXT | NOT NULL DEFAULT 'assigned' CHECK (status IN ('proposed', 'assigned', 'open')) |
owner_key | TEXT, | -- roster portal_email, lowercase; NULL when open |
owner_name | TEXT | |
owner_slack_user_id | TEXT | |
portal_user_id | UUID | |
source | TEXT, | -- email | portal | slack | round_robin | expiry |
event_at | TIMESTAMPTZ, | -- when the human acted |
claimed_at | TIMESTAMPTZ, | -- when the ledger recorded it |
accept_deadline | TIMESTAMPTZ, | -- proposals only |
engaged_by_key | TEXT, | -- a claim held behind a proposal |
engaged_by_name | TEXT | |
engaged_at | TIMESTAMPTZ | |
rotation_hops | INTEGER | NOT NULL DEFAULT 0 |
portal_workspace | TEXT | |
slack_channel_id | TEXT | |
slack_card_ts | TEXT | |
announced_owner_key | TEXT, | -- last (owner, status) posted to Slack |
announced_status | TEXT | |
portal_applied_key | TEXT, | -- last owner written to the portal |
version | INTEGER | NOT NULL DEFAULT 1 |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
lead_claim_events
Defined in: 202609301600_lead_claim_sync.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | NOT NULL |
source | TEXT | NOT NULL |
source_ref | TEXT | NOT NULL |
authority | TEXT | NOT NULL DEFAULT 'claim', -- claim | reassign | release | propose |
actor_key | TEXT, | -- who is claiming / being assigned |
actor_name | TEXT | |
actor_email | TEXT, | -- the From address / Slack id / portal user |
by_name | TEXT, | -- who performed a reassign or release |
event_at | TIMESTAMPTZ | |
outcome | TEXT | NOT NULL DEFAULT 'processing' |
reason | TEXT | |
mode | TEXT | |
previous_owner_key | TEXT | |
portal_written | BOOLEAN | NOT NULL DEFAULT FALSE |
portal_reason | TEXT | |
slack_posted | BOOLEAN | NOT NULL DEFAULT FALSE |
slack_reply_ts | TEXT | |
slack_reason | TEXT | |
error_message | TEXT | |
processing_time_ms | INTEGER | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
campaign_rosters
Observed campaign membership per sender (operator roster refresh, 2026-10)
Defined in: 202610010900_operator_tables.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
campaign_id | INTEGER | NOT NULL |
bison_sender_email_id | INTEGER | NOT NULL |
campaign_name | TEXT | |
campaign_status | TEXT | |
present | BOOLEAN | NOT NULL DEFAULT true |
first_seen_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
last_seen_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
infra_decisions
Infrastructure operator decisions ledger: every limit / warm-up / tag / membership change proposed, applied or observed (2026-10)
Defined in: 202610010900_operator_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
run_id | TEXT | |
policy | TEXT | NOT NULL |
kind | TEXT | NOT NULL CHECK (kind IN ('campaign', 'warmup', 'warmup_enabled', 'burnt_tag', 'campaign_member')) |
source | TEXT | NOT NULL DEFAULT 'operator' CHECK (source IN ('operator', 'external', 'human')) |
status | TEXT | NOT NULL DEFAULT 'proposed' |
bison_sender_email_id | INTEGER | NOT NULL |
email_address | TEXT | |
workspace_name | TEXT | NOT NULL |
ms365_panel | SMALLINT | |
campaign_id | INTEGER | |
before | INTEGER | |
after | INTEGER | |
reason | TEXT | |
detail | JSONB | |
decided_by | TEXT | |
applied_at | TIMESTAMPTZ | |
verified_at | TIMESTAMPTZ | |
expires_at | TIMESTAMPTZ | |
error | TEXT |
infra_runs
Infrastructure operator run summaries (2026-10)
Defined in: 202610010900_operator_tables.sql
| Column | Type | Constraints |
|---|---|---|
run_id | TEXT | PRIMARY KEY |
started_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
finished_at | TIMESTAMPTZ | |
kind | TEXT | NOT NULL DEFAULT 'daily' CHECK (kind IN ('daily', 'bounce_tick', 'review_apply', 'reverse')) |
summary | JSONB | NOT NULL DEFAULT '{}'::jsonb |
email_account_limit_changes
Defined in: 202610010900_operator_tables.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
changed_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
bison_sender_email_id | INTEGER | |
email_address | TEXT | |
workspace_name | TEXT | |
ms365_panel | SMALLINT | |
kind | TEXT | NOT NULL CHECK (kind IN ('campaign', 'warmup', 'warmup_enabled', 'burnt_tag')) |
before | INTEGER | |
after | INTEGER | |
processed_at | TIMESTAMPTZ |
operator_box_stats_cache
Defined in: 202610010900_operator_tables.sql
| Column | Type | Constraints |
|---|---|---|
email_address | TEXT | PRIMARY KEY |
sent | BIGINT | NOT NULL DEFAULT 0 |
bounced | BIGINT | NOT NULL DEFAULT 0 |
replied | BIGINT | NOT NULL DEFAULT 0 |
warmup_sent | BIGINT | NOT NULL DEFAULT 0 |
days_sending | BIGINT | NOT NULL DEFAULT 0 |
last_send_date | DATE | |
first_campaign_send_at | DATE | |
computed_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
operator_feedback
Review comments on infrastructure operator proposal lines (2026-10)
Defined in: 202610011300_operator_feedback.sql
| Column | Type | Constraints |
|---|---|---|
id | BIGSERIAL | PRIMARY KEY |
at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
author | TEXT | NOT NULL |
line_key | TEXT | NOT NULL, -- "panel|93|panel_limits|warmup" or "root|ws|domain|burnt_tags|burnt_tag" |
policy | TEXT | |
verdict | TEXT | NOT NULL CHECK (verdict IN ('right', 'wrong', 'question')) |
note | TEXT | |
snapshot | JSONB | |
resolved_at | TIMESTAMPTZ | |
resolved_by | TEXT |
burnt_verdicts
Nightly burn verdict per (workspace, root) at the tag line; the history the burnt lifecycle counts detections on (2026-10)
Defined in: 202610011500_burnt_lifecycle.sql
| Column | Type | Constraints |
|---|---|---|
asof | DATE | NOT NULL |
workspace_name | TEXT | NOT NULL |
root_domain | TEXT | NOT NULL |
state | TEXT | NOT NULL, -- v3 state at the tag line: burnt | healthy | ramping | not_enough_data | idle |
lane | TEXT, | -- rolling | remainder | bounce |
watch | BOOLEAN | NOT NULL DEFAULT false, -- burnt at the watch line only |
zero_reply | BOOLEAN | NOT NULL DEFAULT false, -- sustained burn with no reply at all (window and 30 days) |
measured | BOOLEAN | NOT NULL DEFAULT false |
fresh | BOOLEAN | NOT NULL DEFAULT false, -- enough sends in the last 7 days to be new evidence |
detected | BOOLEAN | NOT NULL DEFAULT false, -- would start a lifecycle that day (own-lane sustained burn, or dead on arrival) |
window_sent | INTEGER | |
window_replied | INTEGER | |
window_rate | NUMERIC | |
bounce_rate | NUMERIC | |
sent_7d | INTEGER | |
replied_7d | INTEGER | |
days_burnt_last_7 | INTEGER | |
boxes | INTEGER | |
recorded_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
burnt_roots
Burnt lifecycle per (workspace, root): detections, stage and the gates to the next step; advanced by every operator daily run (2026-10)
Defined in: 202610011500_burnt_lifecycle.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | NOT NULL |
root_domain | TEXT | NOT NULL |
stage | TEXT | NOT NULL CHECK (stage IN ('grace', 'confirmed', 'delete', 'recovered', 'done')) |
detections | INTEGER | NOT NULL DEFAULT 0, -- weekly detections in a row, each on fresh sends |
zero_reply | BOOLEAN | NOT NULL DEFAULT false |
stalled | BOOLEAN | NOT NULL DEFAULT false, -- no fresh sends at the last check: cannot move by itself |
tag_only | BOOLEAN | NOT NULL DEFAULT false, -- carries the Burnt tag but no detection is on record |
first_detected_on | DATE | NOT NULL |
last_detected_on | DATE | NOT NULL |
last_evidence_on | DATE | |
last_checked_on | DATE | |
next_check_on | DATE | |
recovered_on | DATE | |
manual_burnt_on | DATE, | -- a person marked it truly burnt |
manual_burnt_by | TEXT | |
boxes | INTEGER | NOT NULL DEFAULT 0, -- present mailboxes on the root |
boxes_tagged | INTEGER | NOT NULL DEFAULT 0 |
boxes_in_campaign | INTEGER | NOT NULL DEFAULT 0 |
boxes_warmup_on | INTEGER | NOT NULL DEFAULT 0 |
provider | TEXT, | -- azure | microsoft | google | mixed |
vendor | TEXT, | -- who supplies the mailboxes; 'own panels' for our tenants |
gates | JSONB | NOT NULL DEFAULT '{}'::jsonb, -- what still blocks the next step, and the next action |
evidence | JSONB | NOT NULL DEFAULT '{}'::jsonb, -- the last verdict, for the board |
cohort_id | INTEGER | REFERENCES public.burnt_cohorts(id) ON DELETE SET NULL |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT now() |
campaign_roster_refreshes
Defined in: 202610011500_burnt_lifecycle.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | PRIMARY KEY |
refreshed_at | TIMESTAMPTZ | NOT NULL |
members | INTEGER | NOT NULL DEFAULT 0 |
unread | INTEGER | NOT NULL DEFAULT 0 -- campaigns whose roster could not be read in that refresh |
lead_claim_clickup_tasks
Defined in: 202610011800_lead_claim_clickup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | NOT NULL |
task_id | TEXT | NOT NULL |
list_id | TEXT | |
task_url | TEXT | |
applied_owner_key | TEXT, | -- owner the task's assignee was last set to ('' = unassigned) |
applied_status | TEXT, | -- ledger status last reflected on the task |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
lead_claim_clickup_posts
Defined in: 202610011800_lead_claim_clickup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | NOT NULL |
channel_id | TEXT | NOT NULL |
message_id | TEXT | NOT NULL |
posted_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
lead | JSONB | NOT NULL DEFAULT '{}'::jsonb, -- name, contact fields, custom variables as posted |
brief | JSONB | NOT NULL DEFAULT '{}'::jsonb, -- readiness, what is in hand, what is missing |
messages | JSONB | NOT NULL DEFAULT '[]'::jsonb, -- the homeowner's own messages, oldest first |
attachments | JSONB | NOT NULL DEFAULT '[]'::jsonb |
links | JSONB | NOT NULL DEFAULT '{}'::jsonb |
reply_cursor_ms | BIGINT | NOT NULL DEFAULT 0, -- newest thread reply already read |
last_lead_reply_ref | TEXT, | -- newest homeowner message already relayed |
reminder_sent_at | TIMESTAMPTZ | |
escalated_at | TIMESTAMPTZ | |
owner_nudged_at | TIMESTAMPTZ, | -- claimed, but no email to the homeowner seen yet |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
lead_claim_clickup_backlog
Defined in: 202610011800_lead_claim_clickup.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
workspace_name | TEXT | NOT NULL |
lead_email | TEXT | NOT NULL |
priority | INTEGER | NOT NULL DEFAULT 0, -- higher goes first |
tier | TEXT, | -- waiting_on_us | ready_to_quote | engaged | interested |
status | TEXT | NOT NULL DEFAULT 'queued' CHECK (status IN ('queued', 'released', 'skipped')) |
reason | TEXT | |
lead | JSONB | NOT NULL DEFAULT '{}'::jsonb |
messages | JSONB | NOT NULL DEFAULT '[]'::jsonb |
waiting_since | DATE | |
queued_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
released_at | TIMESTAMPTZ | |
released_to | TEXT, | -- producer the lead was handed to |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
lead_claim_clickup_state
Defined in: 202610011800_lead_claim_clickup.sql
| Column | Type | Constraints |
|---|---|---|
workspace_name | TEXT | PRIMARY KEY |
channel_cursor_ms | BIGINT | NOT NULL DEFAULT 0 |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
ops_alerts
Defined in: 202610041300_ops_alerts.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
seq | BIGSERIAL | NOT NULL UNIQUE, -- stream cursor (EventSource since_seq) |
severity | TEXT | NOT NULL DEFAULT 'warning' CHECK (severity IN ('info', 'warning', 'critical')) |
source | TEXT | NOT NULL, -- emitter slug: ops, infra_disconnect, bounce, billing, ... |
title | TEXT | NOT NULL |
body | TEXT | NOT NULL DEFAULT '' |
link_path | TEXT, | -- dashboard path, e.g. /infrastructure?ws=x |
dedupe_key | TEXT | NOT NULL, -- caller-supplied or sha1(source + title) |
first_seen | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
last_seen | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
count | INTEGER | NOT NULL DEFAULT 1 |
acknowledged_by | TEXT, | -- user email; one ack silences everyone |
acknowledged_at | TIMESTAMPTZ | |
resolved_at | TIMESTAMPTZ | |
escalated_at | TIMESTAMPTZ, | -- ops_alerts.escalate_unacknowledged stamp |
meta | JSONB | NOT NULL DEFAULT '{}'::jsonb |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
ops_alert_prefs
Defined in: 202610041300_ops_alerts.sql
| Column | Type | Constraints |
|---|---|---|
user_id | UUID | PRIMARY KEY |
min_severity | TEXT | NOT NULL DEFAULT 'info' CHECK (min_severity IN ('info', 'warning', 'critical')) |
sound | BOOLEAN | NOT NULL DEFAULT TRUE |
quiet_hours | JSONB, | -- {start:"22:00", end:"07:00", tz:"America/Chicago", critical:"notify"|"ring"|"silent"} |
muted_sources | TEXT[] | NOT NULL DEFAULT '{}' |
ringtone | TEXT | NOT NULL DEFAULT 'classic', -- classic | chime | siren | pulse | bell |
warning_sound | BOOLEAN | NOT NULL DEFAULT TRUE |
source_overrides | JSONB | NOT NULL DEFAULT '{}'::jsonb, -- {source: ring|notify|feed|mute} |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
desktop_app_policy
Defined in: 202610041300_ops_alerts.sql
| Column | Type | Constraints |
|---|---|---|
app | TEXT | PRIMARY KEY CHECK (app IN ('dashboard', 'portal')) |
min_version | TEXT | NOT NULL DEFAULT '0.1.0' |
disabled | BOOLEAN | NOT NULL DEFAULT FALSE |
message | TEXT | |
download_url | TEXT | |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
ops_alert_routes
Defined in: 202610041300_ops_alerts.sql
| Column | Type | Constraints |
|---|---|---|
id | UUID | PRIMARY KEY DEFAULT gen_random_uuid() |
source | TEXT | NOT NULL DEFAULT '', -- registry key or '' = any |
min_severity | TEXT | NOT NULL CHECK (min_severity IN ('info', 'warning', 'critical')) |
recipients | JSONB | NOT NULL DEFAULT '{"all": true}'::jsonb, -- {"all": true} | {"emails": [...]} |
behavior | TEXT | NOT NULL CHECK (behavior IN ('ring', 'notify', 'feed', 'mute')) |
ringtone | TEXT | |
ringtone_locked | BOOLEAN | NOT NULL DEFAULT FALSE |
enabled | BOOLEAN | NOT NULL DEFAULT TRUE |
priority | INTEGER | NOT NULL DEFAULT 100 |
created_by | TEXT | |
created_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
updated_at | TIMESTAMPTZ | NOT NULL DEFAULT NOW() |
fairplan_replies
Defined in: 20261013220000_fairplan_replies.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | primary key default gen_random_uuid() |
lead_reply_id | uuid | not null unique |
workspace_name | text | not null |
lead_email | text | not null |
lead_name | text | |
bison_reply_id | bigint | |
conversation_url | text | |
client_id | uuid | |
client_token | text | |
intent | text | not null check (intent in ('yes','no','question','later','other')) |
reasoning | text | |
reply_text | text | |
draft | text | |
status | text | not null default 'pending' check (status in ('pending','sending','sent','skipped','failed','declined','review')) |
decided_by | text | |
decided_at | timestamptz | |
sent_at | timestamptz | |
error | text | |
slack_channel | text | |
slack_ts | text | |
created_at | timestamptz | not null default now() |
operator_box_snapshots
what every mailbox looked like to the operator each night (limits, warm-up, tags, campaign membership); the diff between two nights, less the ledger, is what people and scripts changed
Defined in: 202610141500_operator_rails.sql
| Column | Type | Constraints |
|---|---|---|
snapshot_date | date | not null |
bison_sender_email_id | integer | not null |
workspace_name | text | not null |
email_address | text | not null |
campaign_limit | integer | |
warmup_limit | integer | |
warmup_enabled | boolean | |
bison_status | text | |
burnt | boolean | not null default false |
probation | boolean | not null default false |
backup | boolean | not null default false |
in_active_campaign | boolean | not null default false |
ms365_panel | integer | |
infrastructure_order_id | integer | |
recorded_at | timestamptz | not null default now() |
operator_box_origins
present mailboxes that came from another client
Defined in: 202610142200_operator_origins_ledger.sql
| Column | Type | Constraints |
|---|---|---|
bison_sender_email_id | integer | primary key |
email_address | text | not null |
workspace_name | text | not null, -- where it is now |
root_domain | text | |
origin_workspace | text | not null, -- where it came from (a workspace slug) |
origin_client | text, | -- the client's name as people say it (seed), when the slug is not enough |
moved_at | date, | -- the day it arrived here, when known |
source | text | not null, -- mirror_moved_to | change_log | seed:<name> | person:<who> |
vendor | text | |
mailin_order_id | integer | |
recorded_at | timestamptz | not null default now() |
updated_at | timestamptz | not null default now() |
operator_fleet_ledger
nightly fleet counts per workspace x vendor x provider x own/backup as the operator read them (fleet_ledger.py); history kept
Defined in: 202610142200_operator_origins_ledger.sql
| Column | Type | Constraints |
|---|---|---|
ledger_date | date | not null |
workspace_name | text | not null |
vendor | text | not null default '-' |
provider | text | not null default '-' |
backup | boolean | not null default false |
boxes | integer | not null default 0 |
burnt | integer | not null default 0 |
probation | integer | not null default 0 |
warming | integer | not null default 0, -- warm-up not done yet (order stage / warm-up age) |
ready_idle | integer | not null default 0, -- warmed, clean, on no campaign at all |
live | integer | not null default 0, -- on an active campaign |
paused_only | integer | not null default 0, -- only on paused campaigns |
warmup_on | integer | not null default 0 |
recorded_at | timestamptz | not null default now() |
registrar_domain_observations
Append-only registrar observations, not purchase receipts. Existing-roster seeds begin history at migration time; registry registration_date is never acquisition evidence.
Defined in: 202610171210_registrar_purchase_observations.sql
| Column | Type | Constraints |
|---|---|---|
id | bigserial | PRIMARY KEY |
root | text | NOT NULL |
account_id | integer | NOT NULL REFERENCES public.registrar_accounts(id) |
kind | text | NOT NULL CHECK (kind IN ('discovered', 'changed')) |
source | text | NOT NULL CHECK (source IN ('registrar_api', 'registrar_csv', 'existing_roster', 'unspecified')) |
collected_at | timestamptz | NOT NULL |
recorded_at | timestamptz | NOT NULL DEFAULT now() |
registration_date | date | |
previous_registration_date | date | |
expiration_date | date | |
previous_expiration_date | date | |
auto_renew | boolean | |
previous_auto_renew | boolean | |
registrar_status | text | |
previous_registrar_status | text |
domain_lifecycle_alert_deliveries
Defined in: 202610171230_domain_lifecycle_alerts.sql
| Column | Type | Constraints |
|---|---|---|
id | uuid | PRIMARY KEY |
channel_id | text | NOT NULL |
body | text | NOT NULL |
status | text | NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'sending', 'sent')) |
attempts | integer | NOT NULL DEFAULT 0 |
lease_token | uuid | |
lease_expires_at | timestamptz | |
last_error | text | |
slack_ts | text | |
sent_at | timestamptz | |
created_at | timestamptz | NOT NULL DEFAULT now() |
updated_at | timestamptz | NOT NULL DEFAULT now() |
domain_lifecycle_alert_events
Defined in: 202610171230_domain_lifecycle_alerts.sql
| Column | Type | Constraints |
|---|---|---|
channel_id | text | NOT NULL |
event_key | text | NOT NULL |
delivery_id | uuid | NOT NULL REFERENCES public.domain_lifecycle_alert_deliveries(id) |
created_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 |
uq_warmup_health_open | warmup_health | workspace_name, root_domain |
idx_warmup_health_status_seen | warmup_health | status, last_seen_at DESC |
idx_warmup_health_scan_run | warmup_health | scan_run_id |
idx_warmup_health_ws | warmup_health | workspace_name, status |
idx_client_metrics_unmeasured | client_metrics | metric_date, workspace_name |
idx_sds_open_eligible | sender_disconnect_state | adapter, next_eligible_at |
idx_email_accounts_ms365_panel | email_accounts | ms365_panel |
idx_email_accounts_ms365_tenant | email_accounts | ms365_tenant_id |
uq_expired_token_run_ws_email | expired_token_snapshot | run_date, workspace_name, email_address |
idx_expired_token_run_date | expired_token_snapshot | run_date DESC |
idx_expired_token_owner | expired_token_snapshot | run_date, owner |
idx_hall_of_fame_nominations_featured | hall_of_fame_nominations | vote_count DESC, created_at DESC |
idx_reconnect_daily_cohort_open | reconnect_daily_cohort | cohort_date |
idx_audit_rank_by_subject_lower | audit_rank_by_subject | vertical_id, window_key, interested_rate_lower_pct DESC |
idx_audit_rank_by_pitch_lower | audit_rank_by_pitch | vertical_id, window_key, interested_rate_lower_pct DESC |
idx_mcp_audit_log_created_at | mcp_audit_log | created_at |
idx_mcp_audit_log_user_id | mcp_audit_log | user_id |
idx_key_candidates_workspace_name | key_candidates | workspace_name |
idx_mcp_audit_runs_created_at | mcp_audit_runs | created_at |
idx_mcp_audit_findings_run_id | mcp_audit_findings | run_id |
idx_mcp_audit_findings_workspace_name | mcp_audit_findings | workspace_name |
idx_burnt_cohorts_bounce_wave | burnt_cohorts | workspace_name, detected_at DESC |
idx_job_runs_task_name_started | job_runs | task_name, started_at DESC |
idx_kpi_shadow_compare_run_at | kpi_shadow_compare | run_at DESC |
idx_kpi_shadow_compare_ws | kpi_shadow_compare | workspace_name, run_at DESC |
idx_workspace_window_stats_synced | workspace_window_stats | window_days, synced_at DESC |
idx_intraday_snapshots_day_ws | intraday_snapshots | chicago_day, workspace_name |
idx_mcp_known_causes_workspace | mcp_known_causes | workspace_name |
idx_mcp_known_causes_active | mcp_known_causes | is_active |
uq_client_registry_bison_ws_active | client_registry | bison_workspace_id |
idx_irq_active_hold | interested_review_queue | workspace_name, lower(lead_email |
idx_irq_ws_email_blocking | interested_review_queue | workspace_name, lower(lead_email |
idx_irq_status_created | interested_review_queue | status, created_at |
bison_tokens_team_id_idx | bison_tokens | team_id |
idx_mcp_users_user_profile_id | mcp_users | user_profile_id |
idx_task_proposals_batch_id | task_proposals | batch_id |
idx_task_proposal_batches_reviewer_status | task_proposal_batches | reviewer_id, status, created_at DESC |
idx_task_proposal_batches_created_by | task_proposal_batches | created_by, created_at DESC |
idx_task_bot_events_ts | task_bot_events | ts DESC |
idx_task_bot_events_profile_ts | task_bot_events | profile_id, ts DESC |
email_accounts_instance_sender_key | email_accounts | bison_instance, bison_sender_email_id |
idx_email_accounts_present | email_accounts | bison_instance, workspace_name |
account_sync_waves_wave_instance_ws_key | account_sync_waves | wave_id, bison_instance, workspace_name |
idx_account_sync_waves_ws_complete | account_sync_waves | workspace_name, bison_instance, completed_at DESC |
idx_account_sync_waves_wave | account_sync_waves | wave_id |
idx_nurture_candidates_status_created | nurture_candidates | status, created_at |
idx_nurture_candidates_ws_email | nurture_candidates | workspace_name, lower(lead_email |
idx_nurture_candidates_batch | nurture_candidates | batch_id |
idx_nurture_candidates_queue | nurture_candidates | status, priority, reply_date DESC |
kpi_client_settings_audit_workspace_changed_idx | kpi_client_settings_audit | workspace_name, changed_at DESC |
nurture_lab_runs_created_idx | nurture_lab_runs | created_at DESC |
idx_domain_daily_stats_date | domain_daily_stats | stat_date |
idx_domain_daily_stats_root_date | domain_daily_stats | root_domain, stat_date |
idx_domain_stats_runs_ws_started | domain_stats_runs | workspace_name, started_at DESC |
infra_targets_audit_key_changed_idx | infra_targets_audit | scope, key, changed_at DESC |
registrar_domains_expiration_idx | registrar_domains | expiration_date |
registrar_domains_account_idx | registrar_domains | account_id |
infra_vendor_orders_order_idx | infra_vendor_orders | infrastructure_order_id |
infra_vendor_orders_live_root_uq | infra_vendor_orders | infrastructure_order_id, vendor, root |
infra_vendor_orders_vendor_id_uq | infra_vendor_orders | vendor, vendor_order_id |
infra_vendor_tickets_order_idx | infra_vendor_tickets | infrastructure_order_id |
infra_vendor_tickets_open_idx | infra_vendor_tickets | status |
infra_sender_moves_order_idx | infra_sender_moves | infrastructure_order_id |
infra_sender_moves_batch_idx | infra_sender_moves | batch_id |
infra_pipeline_steps_onboarding_idx | infra_pipeline_steps | client_onboarding_id, created_at |
infra_pipeline_steps_order_idx | infra_pipeline_steps | infrastructure_order_id, created_at |
infra_pipeline_steps_open_idx | infra_pipeline_steps | status, updated_at |
infra_pipeline_steps_updated_idx | infra_pipeline_steps | updated_at DESC |
domain_purchase_plans_onboarding_idx | domain_purchase_plans | client_onboarding_id |
domain_purchase_plans_status_idx | domain_purchase_plans | status |
domain_purchase_items_plan_status_idx | domain_purchase_items | plan_id, status |
domain_purchase_items_purchased_at_idx | domain_purchase_items | purchased_at |
domain_dns_intents_onboarding_idx | domain_dns_intents | client_onboarding_id |
domain_dns_intents_drift_state_idx | domain_dns_intents | drift_state |
ms365_provisioning_runs_open_order_uq | ms365_provisioning_runs | order_id |
ms365_provisioning_runs_status_idx | ms365_provisioning_runs | status |
ms365_provisioning_runs_panel_idx | ms365_provisioning_runs | panel_number |
ms365_provisioning_run_logs_run_idx | ms365_provisioning_run_logs | run_id, logged_at |
ms365_provisioning_run_logs_step_idx | ms365_provisioning_run_logs | step, logged_at |
ms365_seat_reservations_active_idx | ms365_seat_reservations | panel_number |
ms365_recon_findings_open_uq | ms365_recon_findings | kind, COALESCE(panel_number, 0 |
idx_ms365_domain_tenants_tenant | ms365_domain_tenants | tenant_id |
idx_ms365_domain_tenants_resolved_at | ms365_domain_tenants | resolved_at |
idx_ms365_panel_tag_runs_started | ms365_panel_tag_runs | started_at DESC |
domain_root_assignments_order_idx | domain_root_assignments | infrastructure_order_id |
infra_ws2_canary_one_enabled | infra_ws2_canary_policies | enabled |
infra_ws2_canary_scope_order_idx | infra_ws2_canary_scopes | infrastructure_order_id |
infra_ws2_canary_identity_uq | infra_ws2_canary_reservations | action, (CASE WHEN action = 'placement' THEN '*' ELSE bison_instance END |
infra_ws2_canary_budget_idx | infra_ws2_canary_reservations | policy_id, reserved_at |
infra_ws2_canary_receipt_idx | infra_ws2_canary_reservations | reservation_id |
infra_ws2_staging_recovery_idx | infra_ws2_canary_reservations | recovery_checked_at NULLS FIRST, id |
infra_ws2_canary_reservation_scope_idx | infra_ws2_canary_reservations | scope_id |
infra_pipeline_observations_flag_time_idx | infra_pipeline_step_observations | flag_key, observed_at DESC, id DESC |
infra_pipeline_observations_time_idx | infra_pipeline_step_observations | observed_at DESC, id DESC |
infra_pipeline_observations_scope_step_idx | infra_pipeline_step_observations | scope_key, step_key, id DESC |
infra_pipeline_observations_step_id_idx | infra_pipeline_step_observations | step_key, id DESC |
idx_order_events_to_stage_created | infrastructure_order_events | to_stage, created_at |
idx_bounce_digest_events_pending | bounce_digest_events | processed_at, event_key |
idx_warmup_gate_snapshots_date | warmup_gate_snapshots | snapshot_date |
idx_mailbox_limit_ledger_panel_at | mailbox_limit_ledger | ms365_panel, at DESC |
idx_mailbox_limit_ledger_sender_at | mailbox_limit_ledger | bison_sender_email_id, at DESC |
idx_mailbox_limit_ledger_reason_at | mailbox_limit_ledger | reason, at DESC |
idx_panel_budget_snapshots_panel_run | panel_budget_snapshots | panel_number, run_at DESC |
task_evidence_run_date_idx | task_evidence | run_date |
task_evidence_task_idx | task_evidence | task_id |
vault_outbox_status_idx | vault_outbox | status, created_at |
meeting_schedule_day_idx | meeting_schedule | starts_at |
work_ownership_rules_enabled_ordinal_idx | work_ownership_rules | enabled, ordinal |
work_ownership_rules_owner_idx | work_ownership_rules | owner_profile_id |
work_rule_overrides_rule_created_idx | work_rule_overrides | rule_key, created_at DESC |
work_rule_overrides_task_idx | work_rule_overrides | task_id |
work_entity_disagreements_open_unique | work_entity_disagreements | entity_type, canonical_name, field |
work_entity_disagreements_status_idx | work_entity_disagreements | status, created_at DESC |
tasks_fingerprint_live_uq | tasks | fingerprint |
tasks_kind_status_idx | tasks | kind, status |
work_findings_log_run_date_idx | work_findings_log | run_date |
work_findings_log_fingerprint_idx | work_findings_log | fingerprint |
llm_traces_call_kind_created_at_idx | llm_traces | call_kind, created_at |
llm_traces_decision_idx | llm_traces | decision |
brain_notes_doc_type_idx | brain_notes | doc_type |
brain_notes_client_key_idx | brain_notes | client_key |
brain_chunks_note_ordinal | brain_chunks | note_path, ordinal |
brain_links_to_path_idx | brain_links | to_path |
work_handoffs_created_idx | work_handoffs | created_at DESC |
work_handoffs_owner_idx | work_handoffs | owner_id, created_at DESC |
lead_loss_checks_status_idx | lead_loss_checks | status, score DESC |
lead_loss_checks_seen_idx | lead_loss_checks | first_seen_at DESC |
exec_briefs_day_idx | exec_briefs | day DESC |
exec_brief_feedback_created_idx | exec_brief_feedback | created_at DESC |
client_onboardings_pilot_idempotency_key_idx | client_onboardings | (form_payload->>'pilot_idempotency_key' |
domain_purchase_operator_expansion_bindings_expansion_idx | domain_purchase_operator_expansion_bindings | expansion_id |
domain_purchase_operator_attempts_expansion_idx | domain_purchase_operator_attempts | expansion_id |
infrastructure_orders_child_unit_root_uniq | infrastructure_orders | parent_order_id, child_root |
infrastructure_orders_parent_order_idx | infrastructure_orders | parent_order_id |
domain_owned_root_adoptions_active_root | domain_owned_root_adoptions | root |
domain_owned_root_adoptions_active_order | domain_owned_root_adoptions | infrastructure_order_id |
idx_bison_change_log_day_ws | bison_change_log | day, workspace_name |
idx_bison_change_log_observed | bison_change_log | observed_at DESC |
idx_bison_change_log_entity | bison_change_log | workspace_name, entity_type, entity_id |
panel_plan_reviews_run_idx | panel_plan_reviews | run_id |
idx_lead_owners_proposed | lead_owners | accept_deadline |
idx_lead_claim_events_lead | lead_claim_events | workspace_name, lead_email, created_at DESC |
campaign_rosters_sender_idx | campaign_rosters | bison_sender_email_id |
campaign_rosters_ws_idx | campaign_rosters | workspace_name, campaign_status |
infra_decisions_run_idx | infra_decisions | run_id |
infra_decisions_box_idx | infra_decisions | bison_sender_email_id, kind, at DESC |
infra_decisions_status_idx | infra_decisions | status, policy, at DESC |
infra_decisions_external_idx | infra_decisions | bison_sender_email_id, kind, expires_at |
email_account_limit_changes_open_idx | email_account_limit_changes | id |
operator_feedback_open_idx | operator_feedback | at DESC |
campaign_rosters_page_idx | campaign_rosters | bison_sender_email_id, campaign_id, workspace_name |
burnt_verdicts_root_idx | burnt_verdicts | workspace_name, root_domain, asof DESC |
burnt_roots_stage_idx | burnt_roots | stage, workspace_name |
idx_lead_claim_clickup_backlog_next | lead_claim_clickup_backlog | workspace_name, priority DESC |
idx_ops_alerts_dedupe_open | ops_alerts | dedupe_key |
idx_ops_alerts_seq | ops_alerts | seq |
idx_ops_alerts_severity_unacked | ops_alerts | severity, acknowledged_at |
idx_ops_alerts_first_seen | ops_alerts | first_seen DESC |
idx_ops_alert_routes_enabled_source | ops_alert_routes | enabled, source |
fairplan_replies_status_idx | fairplan_replies | status, created_at desc |
operator_box_snapshots_ws_idx | operator_box_snapshots | workspace_name, snapshot_date |
operator_box_origins_ws_idx | operator_box_origins | workspace_name, origin_workspace |
operator_fleet_ledger_ws_idx | operator_fleet_ledger | workspace_name, ledger_date |
infrastructure_orders_backup_origin_idx | infrastructure_orders | origin_workspace |
registrar_domain_observations_discovery_idx | registrar_domain_observations | root, account_id |
registrar_domain_observations_history_idx | registrar_domain_observations | account_id, root, id DESC |
domain_lifecycle_alert_pending_idx | domain_lifecycle_alert_deliveries | channel_id, id |
domain_lifecycle_alert_event_delivery_idx | domain_lifecycle_alert_events | delivery_id |
idx_registrar_accounts_covered_by | registrar_accounts | covered_by_account_id |