feat(clickhouse): optional retention TTL on the raw events table#24
Conversation
Adds a readonly `retention` constructor property (days). When set, setup() applies an idempotent TTL to the raw events table so rows older than the window are dropped by background merges; the aggregated events_daily table that backs long-term usage/billing history is left untouched. Null (default) disables retention and actively strips any TTL a previous run applied. Uses a readonly constructor property rather than a getter/setter for coroutine safety, matching the adapter's other config fields. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Greptile SummaryThis PR adds an optional
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to a new optional parameter, the DDL path is gated behind a non-null check, and the idempotency guard for the REMOVE TTL case uses stable dual anchoring. The retention value is typed as No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "fix(clickhouse): anchor REMOVE TTL guard..." | Re-trigger Greptile |
Match both the stable BAD_ARGUMENTS code (36) and a "TTL" mention instead of the full English error phrase, so version-drift in the prose is tolerated while unrelated bad-argument errors still surface. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ports the retention-TTL feature onto
maindirectly (the branches have diverged, so the earlier dev→main PR #23 doesn't apply — this supersedes it).What
Adds an optional
retentionwindow (days) to the ClickHouse adapter. When set,setup()applies an idempotent TTL to the raw events table so rows older than the window are dropped by background merges. The aggregatedevents_dailytable — which backs long-term usage/billing history — is left untouched. Null (the default) disables retention and actively strips any TTL a previous run applied, keepingsetup()re-runnable.Style note
Exposed as a readonly constructor property rather than a getter/setter, matching the adapter's other config fields — more coroutine-safe (no post-construction mutation).
Verification
composer check(phpstan): cleanvendor/bin/pint --test: passClickHouseSchemaTest(integration-gated on a live ClickHouse, like the rest of that class)🤖 Generated with Claude Code