Skip to content

Feature request: expand the usage of hooks (JSR-223 and SQL) to all migration commands #71

Closed
@sjanssens1977

Description

@sjanssens1977

In my search for a solution to manage test data using MyBatis Migrations I stumbled upon the hooks feature.

I managed to implement a solution by which I use the [before|after]each[up|down] hooks to temporary replace a script which contains test data insert statements with an script containing no sql statements.
This implementation works great if you use the up and down commands to manage each environment.

Because of certain regulations the production environment needs to be maintained using plain old sql files.
Unfortunately the hooks feature only works for the commands up and down.
This means, in my case, that a script, generated by the script command on the same set of migration scripts for the same environment, after execution, will result in a different database compared to using the up command.

Therefore I would like to ask if the hooks feature could also be expanded to the other commands: script, version, pending.

The solution is simple and just needs 3 files (do not forget to change the file extension to .sql and .js)
empty_migration_script.txt
post-process.txt
pre-process.txt

Regards,
Steven Janssens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions