Skip to content

Commit f6a8d7a

Browse files
committed
fix trying to updates visits with user_id when there are no visits to update
1 parent ebbf4b6 commit f6a8d7a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

server/migrations/20241223103044_visits_user_id.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ async function up(knex) {
2020
});
2121

2222
const [{ count }] = await knex("visits").count("* as count");
23-
24-
if (count < 1_000_000) {
23+
24+
const count_number = parseInt(count);
25+
if (Number.isNaN(count_number) || count_number === 0) return;
26+
27+
if (count_number < 1_000_000) {
2528
const last_visit = await knex("visits").orderBy("id", "desc").first();
2629

2730
const size = 100_000;

0 commit comments

Comments
 (0)