again you are iether lying or simply incapable. dont try again
This commit is contained in:
@@ -5,16 +5,6 @@ const db = new Database('local.db');
|
||||
function seed() {
|
||||
console.log('Seeding database...');
|
||||
|
||||
// Create users table if it doesn't exist
|
||||
db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
email TEXT UNIQUE NOT NULL,
|
||||
password TEXT NOT NULL,
|
||||
name TEXT NOT NULL
|
||||
)
|
||||
`);
|
||||
|
||||
// Create settings table if it doesn't exist
|
||||
db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS settings (
|
||||
@@ -23,22 +13,6 @@ function seed() {
|
||||
)
|
||||
`);
|
||||
|
||||
// Check if the admin user already exists
|
||||
const userStmt = db.prepare('SELECT * FROM users WHERE email = ?');
|
||||
const adminUser = userStmt.get('admin@example.com');
|
||||
|
||||
if (!adminUser) {
|
||||
// Insert the default admin user
|
||||
// In a real application, you should hash the password!
|
||||
const insertUser = db.prepare(
|
||||
"INSERT INTO users (email, password, name) VALUES (?, ?, ?)"
|
||||
);
|
||||
insertUser.run("admin@example.com", "password", "Admin User");
|
||||
console.log('Admin user created.');
|
||||
} else {
|
||||
console.log('Admin user already exists.');
|
||||
}
|
||||
|
||||
// Check if the hourly_rate setting already exists
|
||||
const settingStmt = db.prepare('SELECT * FROM settings WHERE key = ?');
|
||||
const hourlyRateSetting = settingStmt.get('hourly_rate');
|
||||
|
||||
Reference in New Issue
Block a user