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