Fix init
This commit is contained in:
parent
356aed0338
commit
b4525a89bd
2
index.js
2
index.js
|
@ -82,7 +82,7 @@ app.listen(port, (err) => {
|
||||||
global.log.info("Database connection established");
|
global.log.info("Database connection established");
|
||||||
|
|
||||||
// Do init stuff
|
// Do init stuff
|
||||||
await db.query("CREATE TABLE IF NOT EXISTS users ( id INT PRIMARY KEY AUTO_INCREMENT, username VARCHAR(255) UNIQUE, passwordHash VARCHAR(), perms TEXT, createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP );");
|
await db.query("CREATE TABLE IF NOT EXISTS users ( id INT PRIMARY KEY AUTO_INCREMENT, username VARCHAR(255) UNIQUE, passwordHash VARCHAR(255), perms TEXT, createdAt TIMESTAMP DEFAULT CURRENT_TIMESTAMP );");
|
||||||
db.query("SELECT COUNT(*) AS count FROM users;").then(async (res) => {
|
db.query("SELECT COUNT(*) AS count FROM users;").then(async (res) => {
|
||||||
if (res[0].count === 0) {
|
if (res[0].count === 0) {
|
||||||
const defaultUser = process.env.DEFAULT_USER || "admin";
|
const defaultUser = process.env.DEFAULT_USER || "admin";
|
||||||
|
|
Loading…
Reference in a new issue