All Tests Work! Password reset implemented. Users list sorted.

This commit is contained in:
AG
2025-12-10 12:08:11 +02:00
parent bc9b685dec
commit 5597d45e48
16 changed files with 1033 additions and 39 deletions

View File

@@ -0,0 +1,27 @@
import Database from 'better-sqlite3';
// Use DATABASE_URL if provided, else default
// DATABASE_URL from Prisma usually starts with 'file:'
let dbPath = process.env.DATABASE_URL || './prisma/test.db';
if (dbPath.startsWith('file:')) {
dbPath = dbPath.slice(5);
}
console.log(`Resetting DB at ${dbPath}`);
try {
const db = new Database(dbPath);
// Enable Foreign Keys to ensure cascading deletes work
db.pragma('foreign_keys = ON');
// Optional: WAL mode typically used in app
// db.pragma('journal_mode = WAL');
const info = db.prepare('DELETE FROM User').run();
console.log(`Deleted ${info.changes} users.`);
db.close();
} catch (error) {
console.error('Failed to reset DB:', error);
process.exit(1);
}