``` alter table audit.record_version add column user_id bigint default (coalesce(record, old_record) ->> 'user_id'); ```
or if you meant the SQL `current_user` you could extend the trigger to track it.
but if the user_id is only available in application space (not in the db) it will not be possible using straight SQL
``` alter table audit.record_version add column user_id bigint default (coalesce(record, old_record) ->> 'user_id'); ```
or if you meant the SQL `current_user` you could extend the trigger to track it.
but if the user_id is only available in application space (not in the db) it will not be possible using straight SQL