mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-26 06:04:13 -08:00
Fix: Fix user count check
This commit is contained in:
parent
8d5679a8ab
commit
38fab198bb
|
@ -614,7 +614,7 @@ let needSetup = false;
|
|||
throw new Error("Password is too weak. It should contain alphabetic and numeric characters. It must be at least 6 characters in length.");
|
||||
}
|
||||
|
||||
if ((await R.count("user")) !== 0) {
|
||||
if ((await R.knex("user").count("id as count").first()).count !== 0) {
|
||||
throw new Error("Uptime Kuma has been initialized. If you want to run setup again, please delete the database.");
|
||||
}
|
||||
|
||||
|
@ -1683,7 +1683,7 @@ async function initDatabase(testMode = false) {
|
|||
}
|
||||
|
||||
// If there is no record in user table, it is a new Uptime Kuma instance, need to setup
|
||||
if ((await R.count("user")) === 0) {
|
||||
if ((await R.knex("user").count("id as count").first()).count === 0) {
|
||||
log.info("server", "No user, need setup");
|
||||
needSetup = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue