mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-30 06:29:23 +02:00
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:
parent
5278c4d6f2
commit
ec8d3569d3
10 changed files with 96 additions and 114 deletions
31
server/setup/scriptsPg/1.8.0.ts
Normal file
31
server/setup/scriptsPg/1.8.0.ts
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { db } from "@server/db/pg";
|
||||
|
||||
export default async function migrate() {
|
||||
try {
|
||||
console.log("Starting webauthnChallenge table creation...");
|
||||
|
||||
// Create the table (PostgreSQL already has the correct table name)
|
||||
await db.execute(`
|
||||
CREATE TABLE IF NOT EXISTS webauthnChallenge (
|
||||
sessionId TEXT PRIMARY KEY,
|
||||
challenge TEXT NOT NULL,
|
||||
securityKeyName TEXT,
|
||||
userId TEXT,
|
||||
expiresAt INTEGER NOT NULL,
|
||||
FOREIGN KEY (userId) REFERENCES user(id) ON DELETE CASCADE
|
||||
);
|
||||
`);
|
||||
|
||||
// Create the index
|
||||
await db.execute(`
|
||||
CREATE INDEX IF NOT EXISTS idx_webauthnChallenge_expiresAt ON webauthnChallenge(expiresAt);
|
||||
`);
|
||||
|
||||
console.log("Successfully created webauthnChallenge table and index");
|
||||
return true;
|
||||
} catch (error: any) {
|
||||
console.error("Unable to create webauthnChallenge table:", error);
|
||||
console.error("Error details:", error.message);
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue