Commit 0165cc7
#548 (keyset pagination for get_daily_digest_candidates) and #549 (the
tenant-local streak-nudge comparison) were developed in parallel and landed
within hours of each other. Each merged cleanly on its own; together they left
master in a state neither PR was reviewed in.
Two problems.
1. Duplicate migration version. Both `daily_digest_candidates_pagination` and
`league_rollover_catchup_and_bands` were stamped 20260726140000, so a fresh
`db reset` would try to record two rows under one primary key. The league
migration is independent of everything around it, so it moves to
20260726140500 rather than reordering anything.
2. The #549 digest fix was inert. #548 replaced the zero-argument function with
a three-argument keyset-paginated one, and explicitly DROPped the zero-arg
version because an overload makes a zero-arg call ambiguous (PostgREST 300).
#549's migration then re-created that zero-arg function. Because it sorts
after #548's, a fresh reset ended up with both: the cron passes three named
arguments so it kept resolving to the paginated definition, which still
carried the `= CURRENT_DATE - 1` UTC comparison #549 exists to remove — while
#549's own function sat unused. The bug was live and the fix looked applied.
The #549 migration now replaces the paginated signature, carrying #548's cursor
and ORDER BY over verbatim, so one function has both fixes.
Verified by applying both migrations in file order inside a rolled-back
transaction: exactly one `get_daily_digest_candidates(uuid,uuid,integer)`
survives, it contains `>= CURRENT_DATE - 2`, and it retains `_after_tenant_id`.
502/502 unit tests and typecheck green.
Cloud was already patched directly against the live paginated definition, so it
has been correct throughout; this brings the repo in line with it.
Claude-Session: https://claude.ai/code/session_01RGCEptT7pgWwRiMdB3TUCM
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 9fd240f commit 0165cc7
2 files changed
Lines changed: 30 additions & 8 deletions
File tree
- supabase/migrations
Lines changed: 30 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
23 | 32 | | |
24 | 33 | | |
25 | 34 | | |
26 | 35 | | |
27 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
28 | 41 | | |
29 | 42 | | |
30 | 43 | | |
| |||
76 | 89 | | |
77 | 90 | | |
78 | 91 | | |
79 | | - | |
| 92 | + | |
| 93 | + | |
80 | 94 | | |
81 | 95 | | |
82 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
83 | 105 | | |
84 | 106 | | |
85 | 107 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
0 commit comments