Add option to run `pg_dump` into `migrations/schema.sql` on commit by default
See original GitHub issueFeature description
The README currently recommends doing this yourself, and provides a straightforward example, but IMO this should be built-in and ideally enabled by default once proven out.
My thinking is that reviewing the final schema.sql
should be core to the workflow of using graphile-migrate
– this is an opinionated tool, and it should be okay to enforce this opinion (especially because some of its other opinions don’t work so well without it, like the fact that you can accidentally leave a rnd()
function lying around). I don’t think a tool like this should be used without dumping and reviewing the schema.sql on every commit.
Ideally, any issues people have with this workflow should also be reported and fixes shared, rather than worked around in each user’s bash scripts.
Disclaimer that I am a prospective user, not an active user – this is more a suggestion than a request.
Motivating example
Breaking changes
Supporting development
I [tick all that apply]:
- am interested in building this feature myself
- am interested in collaborating on building this feature
- am willing to help testing this feature before it’s released
- am willing to write a test-driven test suite for this feature (before it exists)
- am a Graphile sponsor ❤️ (patreon)
- have an active support or consultancy contract with Graphile
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
I’d also be interested in being able to edit the pg_dump and having a tool (not necessarily this one) generate an editable migration file. This might be accomplishable by calling into pgadmin’s code for their “schema diff” feature: https://github.com/djrobstep/migra/issues/148
This might help get closer to the more declarative workflows developers tend to like
I did consider it, but I’m not sure that pg_dump is the optimal experience for all users. Some people have other equally valid strategies (for example one person has set up a series of pg_dump scripts that dump different schemas and different resources into different files), so I don’t think enforcing a particular flow (e.g. single pg_dump) is best. Further, people may want to only dump schemas that graphile migrate is used with; I know migrate users that have per-tenant custom schemas that aren’t managed via migrations that they don’t want dumped via pg_dump, so they must pass custom options. Building it in seems like decreased flexibility and greater maintenance burden; though I do think it may be worth enabling (rather than commenting) in the default gmrc.