migrate
migrate copied to clipboard
"Include" comment
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 :wink:
- 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.