Skip to content

Commit d578302

Browse files
rickyromboclaude
andcommitted
Expose updated_at on v_usdc_purchases view
v1_users_purchases.go SELECTs purchases_with_content.updated_at through a CTE wrapping v_usdc_purchases. The view never exposed updated_at, which crashes the /v1/users/{id}/purchases page with: ERROR: column purchases_with_content.updated_at does not exist (SQLSTATE 42703) Alias sp.created_at as updated_at to keep the legacy API contract intact. The legacy usdc_purchases table set both columns to CURRENT_TIMESTAMP at insert and never updated rows, so created_at = updated_at in practice. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 05b43df commit d578302

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

ddl/views/v_usdc_purchases.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ SELECT
1313
sp.content_type::usdc_purchase_content_type AS content_type,
1414
sp.content_id,
1515
sp.created_at,
16+
sp.created_at AS updated_at,
1617
GREATEST(
1718
sp.amount - COALESCE(
1819
CASE sp.content_type

sql/01_schema.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9631,6 +9631,7 @@ CREATE VIEW public.v_usdc_purchases AS
96319631
(sp.content_type)::public.usdc_purchase_content_type AS content_type,
96329632
sp.content_id,
96339633
sp.created_at,
9634+
sp.created_at AS updated_at,
96349635
GREATEST((sp.amount - COALESCE(
96359636
CASE sp.content_type
96369637
WHEN 'track'::text THEN ( SELECT (tph.total_price_cents * 10000)

0 commit comments

Comments
 (0)