'Execute only SQL delta (change) files in Jenkins CI/CD and get deployed on production server

I am new aspirant of DevOps and working on Oracle ci/cd using Jenkins. What I am looking for is, can I able to execute and deploy only recently changed SQL files using Jenkins CI/CD pipeline?

I have found similar blogs but not appropriate one. My task is to execute only recently changed or newly added SQL files (assume there are no dependencies) using jenkins pipeline.

For executing SQL files I am using flyway free edition and gitlab as SCM.

One of my idea is:

To check-in only recently commited files to Jenkins custom workspace and execute only that particular workspace.

Say for example,in current build if I change 4 files in gitlab, only these files need to be dumped on Jenkins custom workspace and my job should execute only those 4 files and for next build if I change only 2 files it should remove old files and new 2 files should be dumped and executed in that custom workspace. Is this possible? I am not sure about it. If not this way, is there any other chances that can work for my current scenario?

I am trying to dump files to workspace so that I can able to copy these files from custom workspace to flyway and then flyway will execute them.

Current challenges are:

-To dump only recently changed files to my custom workspace

-To execute only that particular custom workspace (not main workspace)

I am not sure whether I posted it in understandable way😅, if my idea seems to be complex please provide any other related optimal solutions

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source