Add webhook-event retention job, schema, and testdb pre-flight hint

square_webhook_events is now CREATE TABLE IF NOT EXISTS, registered as the 24th maintenance job (sweep-square-webhook-events, daily 2:30am) pruning rows older than 90 days, and testdb gives a clear docker compose hint when the admin DB connection fails.
This commit is contained in:
2026-08-22 00:34:49 +01:00
parent 5ea89da2ad
commit 8720e28dbe
5 changed files with 155 additions and 2 deletions
+12
View File
@@ -2284,6 +2284,18 @@ CREATE TABLE square_deposits (
CREATE INDEX idx_square_deposits_deposited ON square_deposits(deposited_at);
-- =======================================
-- SQUARE WEBHOOK EVENTS TABLE (Webhook Dedup)
-- =======================================
-- Records every Square webhook event_id the handler has accepted. The webhook
-- handler inserts with ON CONFLICT (event_id) DO NOTHING and treats a 0-row
-- insert as a duplicate, giving restart-safe, at-most-once delivery with no
-- eviction limit (unlike the in-memory fast-path cache).
CREATE TABLE IF NOT EXISTS square_webhook_events (
event_id TEXT PRIMARY KEY,
received_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- =======================================
-- CARDDAV / CALDAV TABLES (used by SabreDAV sync in Go backend)
-- =======================================