File tree Expand file tree Collapse file tree
backend/src/osspckgs/migrations Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -794,6 +794,28 @@ PARTITION BY RANGE (end_date);
794794
795795CREATE INDEX ON downloads_last_30d (purl, end_date DESC );
796796
797+ -- ============================================================
798+ -- AUDIT — per-purl field-change log
799+ --
800+ -- Append-only log of field-level changes. Each row records the set of
801+ -- 'table.column' tokens that were actually mutated for a given purl during one
802+ -- worker write pass. Rows with no real changes are not written (caller skips
803+ -- the insert when changed_fields is empty).
804+ -- ============================================================
805+ CREATE TABLE audit_field_changes (
806+ id bigserial PRIMARY KEY ,
807+ worker text NOT NULL ,
808+ purl text NOT NULL ,
809+ logged_at timestamptz NOT NULL DEFAULT NOW(),
810+ changed_fields text [] NOT NULL
811+ );
812+
813+ CREATE INDEX ON audit_field_changes (purl, logged_at DESC );
814+
815+ CREATE INDEX ON audit_field_changes (worker, logged_at DESC );
816+
817+ CREATE INDEX ON audit_field_changes USING gin (changed_fields);
818+
797819-- ============================================================
798820-- CRITICALITY RANKING FUNCTION
799821-- ============================================================
You can’t perform that action at this time.
0 commit comments