From 1e43c2a14e5bc37bc5caf8e864ebea569ab0c073 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:28:48 -0600 Subject: [PATCH] split --- main.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index e9484ac..77cdfb7 100644 --- a/main.go +++ b/main.go @@ -220,9 +220,19 @@ func handlerPostAPIV1EventsSlackInitialize(cfg Config) http.HandlerFunc { http.Error(w, err.Error(), http.StatusBadRequest) return } + cfg.driver.ExecContext(r.Context(), ` + CREATE TABLE + IF NOT EXISTS + initialization ( + label TEXT, + token TEXT, + updated TIMESTAMP + ) + `) if _, err := cfg.driver.ExecContext(r.Context(), ` - CREATE TABLE IF NOT EXISTS initialization (label TEXT, token TEXT, updated TIMESTAMP); - INSERT INTO initialization (token, updated) VALUES ('slack_events_webhook_token', $1, $2); + INSERT + INTO initialization (token, updated) + VALUES ('slack_events_webhook_token', $1, $2) `, challenge.Token, time.Now().UTC()); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return