Skip to content

Commit d91489e

Browse files
Feat: Official Status Tag Update (#869)
* Add trigger for tracking `official` field updates in `feed` This commit introduces a PostgreSQL trigger and associated function to log changes to the `official` field in the `public.feed` table. It also includes a query to set the `official` field for feeds meeting specific criteria. This enhances data auditability and ensures change history is recorded in `officialstatushistory`. * Removed trigger for logging official tag changes & replaced with direct query update to the 'officialstatushistory' table
1 parent c1e2c57 commit d91489e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- Query to update official tag for feeds with contact email in the feed table where the source is mdb
2+
3+
UPDATE public.feed f
4+
SET official = TRUE
5+
FROM public.externalid e
6+
WHERE f.id = e.feed_id
7+
AND f.feed_contact_email LIKE '%@%'
8+
AND e.source = 'mdb';
9+
10+
-- Query to insert a record in officialstatushistory table for feeds with contact email in the feed table where the source is mdb
11+
INSERT INTO public.officialstatushistory (is_official, feed_id, reviewer_email, timestamp, notes)
12+
SELECT
13+
official,
14+
id,
15+
16+
NOW(),
17+
'Official status tag changed'
18+
FROM public.feed
19+
WHERE feed_contact_email LIKE '%@%'
20+
AND official = TRUE;

0 commit comments

Comments
 (0)