fix getting count on sqlite
This commit is contained in:
parent
40c65b4e59
commit
2ad65f8d24
@ -19,7 +19,7 @@ async function up(knex) {
|
||||
.withKeyName("visits_user_id_foreign");
|
||||
});
|
||||
|
||||
const [{ count }] = await knex("visits").count('*');
|
||||
const [{ count }] = await knex("visits").count("'*' as count");
|
||||
|
||||
if (count < 1_000_000) {
|
||||
const last_visit = await knex("visits").orderBy("id", "desc").first();
|
||||
|
@ -191,7 +191,7 @@ async function totalAdmin(match, params) {
|
||||
}
|
||||
|
||||
query.leftJoin("users", "domains.user_id", "users.id");
|
||||
query.count("domains.id");
|
||||
query.count("domains.id as count");
|
||||
|
||||
const [{ count }] = await query;
|
||||
|
||||
|
@ -70,7 +70,7 @@ async function total(match, params) {
|
||||
);
|
||||
}
|
||||
query.leftJoin("domains", "links.domain_id", "domains.id");
|
||||
query.count("links.id");
|
||||
query.count("links.id as count");
|
||||
|
||||
const [{ count }] = await query;
|
||||
|
||||
@ -106,7 +106,7 @@ async function totalAdmin(match, params) {
|
||||
|
||||
query.leftJoin("domains", "links.domain_id", "domains.id");
|
||||
query.leftJoin("users", "links.user_id", "users.id");
|
||||
query.count("links.id");
|
||||
query.count("links.id as count");
|
||||
|
||||
const [{ count }] = await query;
|
||||
|
||||
|
@ -173,7 +173,7 @@ async function getAdmin(match, params) {
|
||||
|
||||
async function totalAdmin(match, params) {
|
||||
const query = knex("users")
|
||||
.count("users.id")
|
||||
.count("users.id as count")
|
||||
.fromRaw('users')
|
||||
.where(normalizeMatch(match));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user