I see this error with the app, reported by NextJS, please fix it. The er

This commit is contained in:
Leon Serfaty G
2025-09-01 07:00:58 +00:00
parent 76759ce374
commit 0d88a26398
+15 -1
View File
@@ -91,6 +91,20 @@ db.exec(`
) )
`); `);
// --- SCHEMA MIGRATION ---
// This will add the emailVerified column if it doesn't exist, fixing old DBs.
try {
const columns = db.pragma('table_info(users)');
const hasEmailVerified = columns.some((col: any) => col.name === 'emailVerified');
if (!hasEmailVerified) {
db.exec('ALTER TABLE users ADD COLUMN emailVerified INTEGER');
console.log('Migrated users table, added emailVerified column.');
}
} catch (e) {
console.error("Could not migrate users table:", e);
}
// --- SEEDING LOGIC --- // --- SEEDING LOGIC ---
console.log('Running database checks and seeding if necessary...'); console.log('Running database checks and seeding if necessary...');
@@ -102,7 +116,7 @@ if (!defaultUser) {
"INSERT INTO users (id, email, password, name, emailVerified) VALUES (?, ?, ?, ?, ?)" "INSERT INTO users (id, email, password, name, emailVerified) VALUES (?, ?, ?, ?, ?)"
); );
// Note: In a real app, hash the password! // Note: In a real app, hash the password!
insertUser.run('cl-admin-user-id', 'admin@example.com', 'password', 'Admin User', Date.now()); insertUser.run('cl-admin-user-id', 'admin@example.com', 'password', 'Admin User', null);
console.log('Default user created.'); console.log('Default user created.');
} }