Commit e3eb44f
fix(purchases): expose updated_at on v_usdc_purchases view (#819)
## Summary
Hotfix for a regression introduced by #816. \`/v1/users/{id}/purchases\`
crashes with:
\`\`\`
ERROR: column purchases_with_content.updated_at does not exist (SQLSTATE
42703)
\`\`\`
\`api/v1_users_purchases.go:123\` selects
\`purchases_with_content.updated_at\` through a CTE wrapping
\`v_usdc_purchases\`, but the view never exposed \`updated_at\`.
Fix: alias \`sp.created_at\` as \`updated_at\` in the view. The legacy
\`usdc_purchases\` table set both columns to \`CURRENT_TIMESTAMP\` at
insert and never updated rows, so \`created_at = updated_at\` in
practice — the alias keeps the API contract intact.
I had this fix as a follow-up commit on the PR #815 branch (\"Expose
updated_at on v_usdc_purchases view\") but it didn't make it into the
squash-merge.
## Test plan
- [ ] \`/v1/users/{id}/purchases\` returns 200 again
- [ ] \`/v1/users/{id}/sales\` (which also selects \`updated_at\` in
\`v1_users_sales.go:94\`) returns 200
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent 05b43df commit e3eb44f
2 files changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9631 | 9631 | | |
9632 | 9632 | | |
9633 | 9633 | | |
| 9634 | + | |
9634 | 9635 | | |
9635 | 9636 | | |
9636 | 9637 | | |
| |||
0 commit comments