chore: fix refresh query

This commit is contained in:
xuu 2025-03-31 11:09:13 -06:00
parent e58cd8e3f1
commit 9db54a0ad9
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F

View File

@ -607,15 +607,14 @@ func chunk(args []any, qry func(int) (string, int), maxArgs int) iter.Seq2[strin
func refreshLastTwt(ctx context.Context, db db) error { func refreshLastTwt(ctx context.Context, db db) error {
qry := ` qry := `
delete from last_twt_on; delete from last_twt_on;
insert into last_twt_on insert into last_twt_on (feed_id, last_twt_on)
select distinct select distinct
feed_id, feed_id,
max(strftime('%Y-%m-%dT%H:%M:%fZ', (substring(text, 1, instr(text, ' ')-1)))) last_twt_on max(strftime('%Y-%m-%dT%H:%M:%fZ', (substring(text, 1, instr(text, ' ')-1)))) last_twt_on
from twts from twts
group by feed_id group by feed_id;
on conflict(feed_id);
delete from twt_mentions; delete from twt_mentions;
insert into twt_mentions insert into twt_mentions (ulid, feed_id)
select distinct select distinct
ulid, ulid,
unhex(replace(trim(value,'{}'),'-','')) feed_id unhex(replace(trim(value,'{}'),'-','')) feed_id