20 lines
549 B
JavaScript
20 lines
549 B
JavaScript
import bcrypt from 'bcryptjs';
|
|
import { pool } from './connection.js';
|
|
|
|
const run = async () => {
|
|
const hash = await bcrypt.hash('changeme123', 12);
|
|
await pool.query(
|
|
`INSERT INTO users (email, password_hash, display_name) VALUES (?, ?, ?)
|
|
ON DUPLICATE KEY UPDATE display_name = VALUES(display_name)`,
|
|
['demo@helpyourneighbour.ch', hash, 'Demo User']
|
|
);
|
|
|
|
console.log('Seed complete.');
|
|
await pool.end();
|
|
};
|
|
|
|
run().catch(async (err) => {
|
|
console.error('Seed failed:', err.message);
|
|
await pool.end();
|
|
process.exit(1);
|
|
});
|