update query
This commit is contained in:
parent
eb032d19f8
commit
e12c66a560
@ -661,13 +661,8 @@ INSERT INTO tokens (AccountID, RefreshToken, AccessToken, AuthCode, Expiration,
|
||||
VALUES ($1, $2, $3, $4, $5, $6);
|
||||
|
||||
-- name: WebhookUpdate :exec
|
||||
UPDATE tokens AS t
|
||||
SET AccessToken = (update_data ->> 'access_token')::varchar(50),
|
||||
RefreshToken = (update_data ->> 'refresh_token')::varchar(50),
|
||||
Expiration = to_timestamp((update_data ->> 'expiration')::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours',
|
||||
CreatedAt = to_timestamp((update_data ->> 'created_at')::bigint) AT TIME ZONE 'UTC' + INTERVAL '3 hours'
|
||||
FROM json_array_elements($1::json) AS update_data
|
||||
WHERE t.accountID = (update_data ->> 'account_id')::VARCHAR(30);
|
||||
UPDATE tokens SET AccessToken = $1,RefreshToken = $2,Expiration = to_timestamp($3) AT TIME ZONE 'UTC' + INTERVAL '3 hours',CreatedAt = to_timestamp($4) AT TIME ZONE 'UTC' + INTERVAL '3 hours'
|
||||
WHERE accountID = $5;
|
||||
|
||||
-- name: GetAllTokens :many
|
||||
SELECT * FROM tokens;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user