Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ddl/migrations/0212_drop_v_challenge_disbursements.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Drop the v_challenge_disbursements compatibility view.
--
-- The view exposed sol_reward_disbursements in the legacy challenge_disbursements
-- column shape and resolved user_id from recipient_eth_address via users.wallet.
-- Two problems made it a poor fit for most callers:
-- 1. It INNER JOINs users on the recipient wallet, so any disbursement whose
-- recipient does not resolve to a current user is silently dropped. Callers
-- that only ask "has this (challenge_id, specifier) been disbursed?" then
-- wrongly treat a paid reward as still-claimable.
-- 2. Only one caller (the disbursements admin listing) actually needs the
-- user_id resolution, and it now inlines the users join.
--
-- All callers have been migrated (see preceding PR), so the view has no
-- remaining consumers. This migration must run only after that binary is
-- deployed.
DROP VIEW IF EXISTS v_challenge_disbursements;
16 changes: 0 additions & 16 deletions ddl/views/v_challenge_disbursements.sql

This file was deleted.

23 changes: 0 additions & 23 deletions sql/01_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10585,29 +10585,6 @@ CREATE TABLE public.user_tips (
);


--
-- Name: v_challenge_disbursements; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW public.v_challenge_disbursements AS
SELECT rd.challenge_id,
rd.specifier,
(rd.amount)::text AS amount,
rd.signature,
rd.slot,
rd.created_at,
users.user_id
FROM (public.sol_reward_disbursements rd
JOIN public.users ON (((lower((users.wallet)::text) = rd.recipient_eth_address) AND (users.is_current = true))));


--
-- Name: VIEW v_challenge_disbursements; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON VIEW public.v_challenge_disbursements IS 'Compatibility view that exposes sol_reward_disbursements in the column shape the API routes used to read from challenge_disbursements. Resolves user_id via the indexer-populated recipient_eth_address (see migration 0172).';


--
-- Name: v_token_transactions_history; Type: VIEW; Schema: public; Owner: -
--
Expand Down
1 change: 1 addition & 0 deletions sql/03_migration_tracker.sql
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ migrations/0208_seed_challenge_checkpoints.sql ed11876806de4dd1d80b389894b4db45
migrations/0209_user_events_blocknumber_idx.sql 19ed339385266f28e83399125b6593df 2026-05-29 19:30:00.000000+00
migrations/0210_notification_cooldown_partial_gin.sql 7156a9b6e236e17acef7d6b91cb1291b 2026-05-29 19:30:00.100000+00
migrations/0211_seed_phase_3_user_event_checkpoints.sql e37093a8ba1d1a4a3bcca7f98b612be2 2026-05-29 19:30:00.200000+00
migrations/0212_drop_v_challenge_disbursements.sql 90097355681a3a9b3cde2586511f0f16 2026-05-29 23:22:07.541889+00
\.


Expand Down
Loading