Files
eagler-tiers/create-admin.js
starified 08bf320b57 uploaded
2026-04-21 22:03:19 -04:00

19 lines
577 B
JavaScript

// create-admin.js (place in project root)
require('dotenv').config();
const bcrypt = require('bcrypt');
const { pool } = require('./server/db');
async function createSuperAdmin() {
const username = 'admin'; // change as needed
const password = 'your-strong-password'; // change this!
const hash = await bcrypt.hash(password, 10);
await pool.query(
'INSERT INTO admin_users (username, password_hash, role) VALUES (?, ?, ?)',
[username, hash, 'superadmin']
);
console.log('Superadmin created');
process.exit();
}
createSuperAdmin().catch(console.error);