Skip to content

Commit

Permalink
fix(migrations) fix migration of not-expiring ttls in oauth2 tokens (K…
Browse files Browse the repository at this point in the history
…ong#4588)

Fixes an issue reported at Kong#4572, where migrations could set a 0 ttl for oauth2_tokens that have never expiring 0 tokens, leading to deletion of such tokens.

Fixes Kong#4572.
  • Loading branch information
bungle authored and hishamhm committed May 9, 2019
1 parent dfbc22b commit 9697aee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kong/plugins/oauth2/migrations/001_14_to_15.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ return {
END$$;
UPDATE "oauth2_tokens"
SET "ttl" = "created_at" + (COALESCE("expires_in", 0)::TEXT || ' seconds')::INTERVAL;
SET "ttl" = "created_at" + ("expires_in"::TEXT || ' seconds')::INTERVAL
WHERE "expires_in" > 0;
ALTER TABLE IF EXISTS ONLY "oauth2_credentials"
Expand Down

0 comments on commit 9697aee

Please sign in to comment.