1 min readOct 13, 2019
Thanks for the feedback, Igor! Caching the schema at build time is definitely a great way of decreasing cold-start time, but it also means you’ll need to rebuild for each schema change, (which is probably not a bad practice, anyway).
The user_id
setting needs to be passed into withPostGraphileContext
's pgSettings
which will automatically set the variable for your queries, as I’ve done here. It is essentially doing the following for you:
BEGIN;
SET "user_id" = '${userId}';
-- GraphQL query from PostGraphile runs here
COMMIT;