mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 08:06:19 +00:00
Build durable request facts and bounded aggregate queries, freeze historical identities, and move recovery lease updates out of request history rows. Align token fields across storage, APIs and pages. Invalidate analytics only after actual request deletions and track embedded migration inputs during builds. Co-authored-by: Codex <noreply@openai.com>
15 lines
661 B
PL/PgSQL
15 lines
661 B
PL/PgSQL
-- 空清理不更新统计代次,避免与启动回填的快照事务发生无效写冲突
|
|
create or replace function invalidate_deleted_request_analytics() returns trigger language plpgsql as $$
|
|
begin
|
|
if exists (select 1 from deleted_requests) then
|
|
update request_analytics_build_state set generation = generation + 1 where singleton;
|
|
end if;
|
|
return null;
|
|
end
|
|
$$;
|
|
|
|
drop trigger request_analytics_delete_invalidation on model_requests;
|
|
create trigger request_analytics_delete_invalidation after delete on model_requests
|
|
referencing old table as deleted_requests
|
|
for each statement execute function invalidate_deleted_request_analytics();
|