Skip to content

Commit d4319ea

Browse files
committed
fix: sqlite condition in MonthlyUsageService
1 parent bf4ba3f commit d4319ea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/src/services/sla/MonthlyUsageService.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class MonthlyUsageService extends BaseService {
3333
const month = new Date().getUTCMonth() + 1;
3434

3535
const maybe_app_id = actor.type.app?.id;
36+
const stringified = JSON.stringify(extra);
3637

3738
// UPSERT increment count
3839
await this.db.write(
@@ -45,8 +46,8 @@ class MonthlyUsageService extends BaseService {
4546
'DO UPDATE SET `count` = `count` + 1, `extra` = ?',
4647
}),
4748
[
48-
year, month, key, actor.type.user.id, maybe_app_id ?? null, JSON.stringify(extra),
49-
...this.db.case({ mysql: [JSON.stringify(extra)], otherwise: [JSON.stringify({ a: 1 })] }),
49+
year, month, key, actor.type.user.id, maybe_app_id ?? null, stringified,
50+
stringified,
5051
]
5152
);
5253
}

0 commit comments

Comments
 (0)