Origin for each line in rsstg.sql from check-in 7393d62235:
61df933942 2020-11-18 arcade: create table rsstg_updates (owner integer, update jsonb); 61df933942 2020-11-18 arcade: 61df933942 2020-11-18 arcade: create unique index rsstg_updates__id on rsstg_updates(update->>'update_id'); 61df933942 2020-11-18 arcade: 61df933942 2020-11-18 arcade: create table rsstg_source ( 61df933942 2020-11-18 arcade: source_id serial, f322efafd9 2020-11-30 arcade: channel text not null, 61df933942 2020-11-18 arcade: channel_id integer not null, 61df933942 2020-11-18 arcade: url text not null, 075be7e40e 2020-11-18 arcade: last_scrape not null timestamptz default now(), 659724c658 2021-12-08 arcade: enabled boolean not null default true, 61df933942 2020-11-18 arcade: iv_hash text, 0340541002 2025-04-24 arcade: owner bigint not null, 0340541002 2025-04-24 arcade: url_re text); 61df933942 2020-11-18 arcade: create unique index rsstg_source__source_id on rsstg_source(source_id); 61df933942 2020-11-18 arcade: create unique index rsstg_source__channel_id__owner on rsstg_source(channel_id, owner); 61df933942 2020-11-18 arcade: create index rsstg_source__owner on rsstg_source(owner); 61df933942 2020-11-18 arcade: 61df933942 2020-11-18 arcade: create table rsstg_post ( 61df933942 2020-11-18 arcade: source_id integer not null, 4e0a19d772 2021-10-01 arcade: posted timestamptz not null, 61df933942 2020-11-18 arcade: url text not null, 4e0a19d772 2021-10-01 arcade: hour smallint not null generated always as (extract('hour' from posted at time zone 'utc')) stored, 4e0a19d772 2021-10-01 arcade: hxm smallint not null generated always as (hxm(posted)) stored, 7393d62235 2026-01-07 arcade: FOREIGN KEY (source_id) REFERENCES rsstg_source(source_id) on delete cascade 61df933942 2020-11-18 arcade: ); 61df933942 2020-11-18 arcade: create unique index rsstg_post__url on rsstg_post(url); 61df933942 2020-11-18 arcade: create index rsstg_post__hour on rsstg_post(hour); 0191d490fe 2020-11-18 arcade: create index rsstg_post__posted_hour on rsstg_post(posted,hour); 4e0a19d772 2021-10-01 arcade: create index rsstg_post__hxm on rsstg_post(hxm); 4e0a19d772 2021-10-01 arcade: create index rsstg_post__posted_hxm on rsstg_post(posted,hxm); 84130ab6bf 2020-11-20 arcade: 4e0a19d772 2021-10-01 arcade: create or replace view rsstg_order_old as acb0a4ac54 2025-09-28 arcade: select acb0a4ac54 2025-09-28 arcade: source_id, acb0a4ac54 2025-09-28 arcade: coalesce(last_scrape + make_interval(0,0,0,0,0,(60 / (coalesce(activity, 1)/7 + 1) )::integer), now() - interval '1 minute') as next_fetch, acb0a4ac54 2025-09-28 arcade: owner, acb0a4ac54 2025-09-28 arcade: last_scrape acb0a4ac54 2025-09-28 arcade: from rsstg_source natural left join 84130ab6bf 2020-11-20 arcade: (select source_id, count(*) as activity 84130ab6bf 2020-11-20 arcade: from rsstg_post where 84130ab6bf 2020-11-20 arcade: hour = extract('hour' from now())::smallint 4e0a19d772 2021-10-01 arcade: and posted > now() - interval '7 days' 4e0a19d772 2021-10-01 arcade: and posted < now() - interval '1 hour' 4e0a19d772 2021-10-01 arcade: group by source_id) as act 4e0a19d772 2021-10-01 arcade: where enabled 4e0a19d772 2021-10-01 arcade: order by next_fetch; 4e0a19d772 2021-10-01 arcade: 4e0a19d772 2021-10-01 arcade: create or replace function hxm(timestamptz) returns smallint 4e0a19d772 2021-10-01 arcade: as $$ select(extract('hour' from $1) * extract('minute' from $1)); $$ 4e0a19d772 2021-10-01 arcade: language sql immutable returns null on null input; 4e0a19d772 2021-10-01 arcade: 4e0a19d772 2021-10-01 arcade: create or replace view rsstg_order as acb0a4ac54 2025-09-28 arcade: select acb0a4ac54 2025-09-28 arcade: source_id, acb0a4ac54 2025-09-28 arcade: coalesce(last_scrape + make_interval(0,0,0,0,0,(60 / (coalesce(activity, 1)/7 + 1) )::integer), now() - interval '1 minute') as next_fetch, acb0a4ac54 2025-09-28 arcade: owner, acb0a4ac54 2025-09-28 arcade: last_scrape acb0a4ac54 2025-09-28 arcade: from rsstg_source natural left join 4e0a19d772 2021-10-01 arcade: (select source_id, count(*) as activity 4e0a19d772 2021-10-01 arcade: from rsstg_post where 4e0a19d772 2021-10-01 arcade: ( 4e0a19d772 2021-10-01 arcade: (hxm > hxm(now()) - 30 and hxm < hxm(now()) + 30) 4e0a19d772 2021-10-01 arcade: or (hxm < 30 and hxm < hxm(now()) + 30 - 1440) 4e0a19d772 2021-10-01 arcade: or (hxm > 1410 and hxm > 1440 + hxm(now()) - 30) 4e0a19d772 2021-10-01 arcade: ) 4e0a19d772 2021-10-01 arcade: and posted < now() - interval '1 hour' 0191d490fe 2020-11-18 arcade: and posted > now() - interval '7 days' 61df933942 2020-11-18 arcade: group by source_id) as act 61df933942 2020-11-18 arcade: where enabled 61df933942 2020-11-18 arcade: order by next_fetch;