Merge pull request #18 from Haelnorr/dbbackups

Fixed catastrophic bug caused by rows not being closed on db ver check
This commit is contained in:
2025-02-22 16:26:53 +11:00
committed by GitHub
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');