20 lines
697 B
JavaScript
20 lines
697 B
JavaScript
const { Pool } = require('pg');
|
|
async function createUser() {
|
|
const pool = new Pool({ connectionString: 'postgresql://postgres:postgres@localhost:5432/xflow' });
|
|
try {
|
|
await pool.query(`
|
|
INSERT INTO "User" (id, username, email, password, role, "updatedAt")
|
|
VALUES ('almalexyz', 'almalexyz', 'almalexyz@gmail.com', 'none', 'admin', NOW())
|
|
ON CONFLICT DO NOTHING
|
|
`);
|
|
await pool.query(`
|
|
INSERT INTO "Profile" (id, "userId", "displayName", "updatedAt")
|
|
VALUES ('almalexyz-profile', 'almalexyz', 'Alexander', NOW())
|
|
ON CONFLICT DO NOTHING
|
|
`);
|
|
console.log('User created!');
|
|
} catch(e) { console.error(e) }
|
|
process.exit(0);
|
|
}
|
|
createUser();
|