Skip to content

fix: resolve missing column references in admin stats queries#650

Merged
bokelley merged 1 commit into
mainfrom
bokelley/fix-engagement-reasons-col
Jan 6, 2026
Merged

fix: resolve missing column references in admin stats queries#650
bokelley merged 1 commit into
mainfrom
bokelley/fix-engagement-reasons-col

Conversation

@bokelley

@bokelley bokelley commented Jan 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Remove engagement_reasons column from queries (computed dynamically, not stored)
  • Fix next_step/next_step_due_date references to use org_activities table via LATERAL join
  • Fix stripe_subscription_status to use correct subscription_status column

Root Cause

The production error column "engagement_reasons" does not exist in /api/admin/my-prospects was caused by queries referencing columns that either:

  1. Don't exist (engagement_reasons is computed in functions, not stored)
  2. Are on a different table (next_step fields are on org_activities, not organizations)
  3. Have a different name (subscription_status not stripe_subscription_status)

Test plan

  • Build passes (npm run build)
  • TypeScript type check passes (npm run typecheck)
  • All tests pass (npm test)
  • Verify admin dashboard loads on production after deploy

🤖 Generated with Claude Code

- Remove engagement_reasons column from queries (computed dynamically, not stored)
- Fix next_step/next_step_due_date references to use org_activities table
- Fix stripe_subscription_status to use correct subscription_status column

These columns were queried from the organizations table but either:
1. Don't exist (engagement_reasons is computed in functions)
2. Are on a different table (next_step fields are on org_activities)
3. Have a different name (subscription_status not stripe_subscription_status)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit 9335dfa into main Jan 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant