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:
@@ -53,6 +53,13 @@ func CreateTestDatabase(dbName string) *pgxpool.Pool {
|
||||
}
|
||||
defer adminPool.Close()
|
||||
|
||||
// Pre-flight check: pgxpool.New is lazy, so surface the admin connection
|
||||
// failure here with actionable guidance instead of a confusing
|
||||
// "database \"crussell_test_...\" does not exist" error further down.
|
||||
if err := adminPool.Ping(ctx); err != nil {
|
||||
log.Fatalf("testdb: run `docker compose up -d postgres` (see README Getting Started) — test database admin connection failed: %v", err)
|
||||
}
|
||||
|
||||
safeName := pgx.Identifier{dbName}.Sanitize()
|
||||
|
||||
// Drop existing database with retries (terminate connections first)
|
||||
|
||||
Reference in New Issue
Block a user