How would you handle incremental SQL patches using Gradle
I am currently working on a product that heavily relies on database logic/functions to realize certain business cases. After having a hard time with quarterly live releases we decided to integrate our projects in a CI environment and to setup a continuous delivery process as a final goal.
At the current moment the database related projects heavliy rely on shell scripts. These scripts are triggered on each release and take care of the incremental import of certain sql patches (e.g. projectX_v_4_0.sql, projectX_v_4_1.sql, ... projectX_v_4_n.sql).
Regretfully this approach is very error prone and also the script logic is not verified/tested at all. Since our experience with Gradle was very good in the past, we decided to evaluate Gradle as an alternative to the existing shell scripts.
My question now is: How would you handle the sequential import of the certain sql patches? Is there a certain framework that you could recommend or would you prefer to execute the psql command from inside Gradle as it was done by the shell scripts before?
Thanks for any hints/recommendations and general thoughts!