faraday/db
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
..
sqlc db: add channel event pruning query and index 2026-06-22 10:10:00 +02:00
interfaces.go mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00
migrations.go db: add channel event pruning query and index 2026-06-22 10:10:00 +02:00
migrations_test.go db: add chanevents tables and queries 2026-04-01 15:06:37 +02:00
postgres.go chanevents+db: widen test fixtures to testing.TB 2026-06-03 17:55:30 +02:00
schemas.go db: add chanevents tables and queries 2026-04-01 15:06:37 +02:00
sql_migrations.go mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00
sqlite.go mod: add sqldbv2 and boilerplate 2026-03-30 11:50:52 +02:00