Harden monitoring TG reanalyze reset
This commit is contained in:
@@ -778,7 +778,13 @@ func (a *app) reanalyzeChannel(ctx context.Context, w http.ResponseWriter, r *ht
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
key := verdictKey(ch.Vertical)
|
key := verdictKey(ch.Vertical)
|
||||||
tag, err := a.db.Exec(ctx, `UPDATE messages SET extracted = COALESCE(extracted, '{}'::jsonb) - $1 WHERE channel_id = $2`, key, id)
|
tag, err := a.db.Exec(ctx, `
|
||||||
|
UPDATE messages
|
||||||
|
SET extracted = (
|
||||||
|
CASE WHEN jsonb_typeof(extracted) = 'object' THEN extracted ELSE '{}'::jsonb END
|
||||||
|
) - $1
|
||||||
|
WHERE channel_id = $2
|
||||||
|
`, key, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
writeDBError(w, err)
|
writeDBError(w, err)
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user