faraday/db/sqlc/migrations
bitromortac e852394bdd
db: add channel event pruning query and index
Add a PruneChannelEvents query that bounds the channel_events table by both
size and age in a single statement: an id-keyset offset enforces a maximum
event count and a timestamp filter enforces a retention window, OR-joined so
each limit applies independently. The query returns the number of rows deleted
so callers can surface pruning activity.

Add a standalone timestamp index so the global age-based prune does not scan
the full table. The existing composite index leads with channel_id and cannot
serve a channel-agnostic timestamp filter.
2026-06-22 10:10:00 +02:00
..
000001_chanevents.down.sql db+chanevents: change to paginated GetChannelEvents 2026-05-08 20:13:58 +02:00
000001_chanevents.up.sql db+chanevents: change to paginated GetChannelEvents 2026-05-08 20:13:58 +02:00
000002_chanevents_ts_idx.down.sql db: add channel event pruning query and index 2026-06-22 10:10:00 +02:00
000002_chanevents_ts_idx.up.sql db: add channel event pruning query and index 2026-06-22 10:10:00 +02:00