Skip to content

Commit

Permalink
Delete the least recent rows that have the same kid and are unrevoked
Browse files Browse the repository at this point in the history
  • Loading branch information
oana-lolea committed Dec 11, 2024
1 parent 6161e06 commit 4d4d980
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ exports.up = async function (knex) {
`DELETE FROM "walletAddressKeys" w
WHERE revoked = false
AND ctid NOT IN (
SELECT MIN(ctid)
SELECT MAX(ctid)
FROM "walletAddressKeys"
WHERE revoked = false
AND kid = w.kid
GROUP BY kid, "walletAddressId"
)`
)
.then(() => {
Expand Down

0 comments on commit 4d4d980

Please sign in to comment.