mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-25 11:45:32 +02:00
- 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.
31 lines
No EOL
984 B
TypeScript
31 lines
No EOL
984 B
TypeScript
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;
|
|
}
|
|
}
|