"Include" comment
benjie opened this issue ยท 5 comments
Feature description
We already have --! no-transaction
special comment, and we have :PLACEHOLDER
replacement... This feature would replace a --! include funcs/my_func.sql
comment with the contents of the funcs/my_func.sql
file from the migrations/
folder. This is akin to symlinking the file into the current/
directory, but with the following advantages:
- works on Windows ๐
- works with
current.sql
in addition tocurrent/
folder - easier to view history in git
- no need to come up with a numeric prefix for it - can just reorder as text
On commit a snapshot of the file will be included into the migrations/committed/
entry (and this is the code that would run on graphile-migrate migrate
, rather than performing the --! include
at that time).
Motivating example
Iterating functions, policies, and other stateless resources can be annoying - having to copy the definitions out from a previous migration or from a DB dump and then edit them. Also tracking history of them is a pain. Easier to edit them in one place (like regular code) and then "pull" them into the migration for execution.
Breaking changes
None.
easier to view history in git
no need to come up with a numeric prefix for it - can just reorder as text
These are really beneficial, any plans for adding them?
Yep, have filed #163 to track the idea for when I (or someone else) have time to implement it.
I was just looking for a way to pull this off, this is exciting :)
@benjie quick question... when do you plan on pushing the next release.... I may be asking selfishly :)
This is already available as graphile-migrate@next:
https://www.npmjs.com/package/graphile-migrate?activeTab=versions