-
-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add how to install watch fixtures yourself to the docs #2293
Comments
Relatedly, as I'm adding these watch fixtures to my migrations, I'm realizing that I need to keep an eye on them any time I update PostGraphile to be sure they aren't changing. While I highly doubt these will change much, if ever, I think it may make sense to have a way to do "watch fixture migrations only" via postgraphile, such that the schema is updated automatically. I think Graphile Worker has similar functionality, though worker's schema changes far more regularly, of course, so it's more useful |
Yes please, though we should tell people how to output the SQL to a file and tell them to check it hasn’t changed on each update since it’s not the supported approach. |
I don't know off the top of my head how to do that, but I'm sure I can figure it out. Will report back |
I'm not sure we can currently; but adding an export seems reasonable:
import { watchFixtures } from "postgraphile/graphile-build-pg/watchFixtures";
import * as fs from "node:fs/promises";
const __dirname = import.meta.dirname; // Or whatever it is; I forget.
await fs.writeFile(`${__dirname}/watchFixtures.sql`, watchFixtures); I'm not bothered about making this too easy since it's not a supported interface - no need to create a CLI for it. |
When setting
grafserv: { watch: true }
and omittingmakePgService
'ssuperUserConnectionString
, Postgraphile errors with the following text:(Great error message, btw! Clear, helpful errors are an underrated part of UX 🙂)
When using Postgraphile myself, I want to install watch fixtures as a part of my db setup so that the server running postgraphile does not need access to super user db creds. I went to check the docs on how to do this, and noticed it wasn't in the docs anywhere. We should add how and why to do this to the docs.
I found the queries here: https://github.com/graphile/crystal/blob/36c41e80bfe312f584af42545688fb78d3adaf3f/graphile-build/graphile-build-pg/src/watchFixtures.ts
A quick 👍 to make sure we're aligned, and I'm happy to make the PR for this addition myself.
The text was updated successfully, but these errors were encountered: