Fixed catastrophic bug caused by rows not being closed on db ver check

This commit is contained in:
2025-02-22 16:24:58 +11:00
parent 554799754d
commit ca42a979c1
2 changed files with 2 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ func checkDBVersion(db *sql.DB, expectVer int) error {
if err != nil {
return errors.Wrap(err, "checkDBVersion")
}
defer rows.Close()
if rows.Next() {
var version int
err = rows.Scan(&version)

View File

@@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS "users" (
created_at INTEGER DEFAULT (unixepoch()),
bio TEXT DEFAULT ""
) STRICT;
CREATE TRIGGER cleanup_expired_tokens
CREATE TRIGGER IF NOT EXISTS cleanup_expired_tokens
AFTER INSERT ON jwtblacklist
BEGIN
DELETE FROM jwtblacklist WHERE exp < strftime('%s', 'now');