sqitch icon indicating copy to clipboard operation
sqitch copied to clipboard

Custom change files naming convention and directory structure

Open wesselvdv opened this issue 7 years ago • 5 comments

What I am looking for is a way to define the naming convention and location of all the scripts that are generated by Sqitch.

I am currently using software from IntelliJ, and they have a nice feature called file nesting. The feature is described nicely on their site. It basically allows you to stay sane, by grouping files that are somehow related. (like revert, deploy, test and verify scripts) It's however not supported when these files are in fact in different directories like with Sqitch.

So instead of the following structure:

Project tree

  • deploy
    • schema
      • change.sql
  • revert
    • schema
      • change.sql
  • verify
    • schema
      • change.sql

I would love to be able to define the following (which would work nicely with file nesting):

Project tree

  • schema
    • tables
      • change.deploy.sql
      • change.revert.sql
      • change.rework.v1.sql
      • change.rework.v2.sql
      • change.verify.sql

EDIT:

Added the rework formatting I would love to see, triggered by #368. Since I have yet to try the rework option I am not sure whether v1 and v2 is correctly reflecting how it currently works.

wesselvdv avatar Dec 20 '17 19:12 wesselvdv

For better or for worse, Sqitch relies on directories for this functionality, not file names. The idea is that the file system provides a perfectly nice method for grouping files, namely directories, so it just relies on them. I can see where it might be interesting to add some sort of template for the file names, though, and then setting the core.deploy_dir, core.revert_dir, and core.verify_dir directories to the same directory.

theory avatar Dec 20 '17 19:12 theory

@theory I am not saying the directory route is a bad approach. Only offering something along the lines of what I am suggesting would push people towards products that offer file nesting like functionalities or they'd probably go mad.

Sidetrack:

  • Are those options that you're mentioning now already available for configuration?
  • What is the best place to look for all the different configuration options? If it's the lib directory in the repo, then I am already looking in the right place.

wesselvdv avatar Dec 20 '17 19:12 wesselvdv

Yes, they are documented in the config docs, but the sqitch-configuration docs go into detail on hierarchical target/engine/core config.

theory avatar Dec 20 '17 20:12 theory

Is there anyway within the current capabilities of Sqitch that I can do to mimic something like this? I was thinking of something with symlinks, but that will definitely get very complex I am afraid.

wesselvdv avatar Dec 22 '17 18:12 wesselvdv

Afraid not, no. I marked this as a feature request in case someone wants to work on it, though.

theory avatar Dec 22 '17 18:12 theory