fix: resolve build errors and improve database migration system

- Remove unused SQLite migration script 1.8.1.ts that was causing
  TypeScript compilation errors during PostgreSQL builds
- Fix verifyTotp.ts type error by adding proper null check for password
  parameter before passing to verifyPassword function
- Fix SQLite migration script 1.7.0.ts syntax errors in transaction
  structure and error handling
**- Update SQLite migration system to not drop tables by default, as this was used during testing and should not be in production.**

Fixes build failures for both "make build" (SQLite) and "make build-pg"
(PostgreSQL) Docker image builds.
This commit is contained in:
Adrian Astles 2025-07-15 06:40:31 +08:00
parent 5278c4d6f2
commit ec8d3569d3
10 changed files with 96 additions and 114 deletions

View file

@ -17,12 +17,17 @@ export default async function migration() {
db.exec(`
ALTER TABLE orgs ADD COLUMN passwordResetTokenExpiryHours INTEGER NOT NULL DEFAULT 1;
`);
})(); // <-- executes the transaction immediately
})(); // executes the transaction immediately
db.pragma("foreign_keys = ON");
console.log(`Added passwordResetTokenExpiryHours column to orgs table`);
} catch (e) {
console.log("Error adding passwordResetTokenExpiryHours column to orgs table:");
console.log(e);
}
try {
db.pragma("foreign_keys = OFF");
db.transaction(() => {
db.exec(`
CREATE TABLE IF NOT EXISTS securityKey (
credentialId TEXT PRIMARY KEY,