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:
@@ -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)
|
||||
-- =======================================
|
||||
|
||||
Reference in New Issue
Block a user