1-- Denormalized postgate upsert: Update posts table directly
2-- Postgates control embedding permissions - now stored in posts table
3-- Parameters: $1=actor_id, $2=post_rkey, $3=rules[], $4=detached_actor_ids[], $5=detached_rkeys[]
4-- Note: We update the post record ($1, $2) with postgate data
5-- The postgate's own (actor_id, rkey, cid) are no longer stored separately
6
7UPDATE posts
8SET
9 postgate_rules = $3::text[]::postgate_rule[],
10 postgate_detached_actor_ids = $4::integer[],
11 postgate_detached_rkeys = $5::bigint[]
12WHERE actor_id = $1
13 AND rkey = $2