Skip to Main Content

SQLcl: MCP Server & SQL Prompt

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SQLcl Project: project deploy includes all objects instead of incremental changes

Alex Payome5 days ago

Hello everyone,

I'm building a deployment script using SQLcl Projects and Git, and I'm facing an issue where my deployments are not incremental as I expect them to be.

My current workflow is as follows:

  1. I create a new feature branch from my main branch (e.g., git checkout -b JIRA-123).
  2. I apply the necessary changes to my development database schema.
  3. I run project export to capture the current state of the database objects into the src/ directory.
  4. I then run project stage -verbose. This command correctly shows me only the objects that have been modified or are new for this release.
  5. Next, I run project release -version JIRA-123 to create the Git tag for the new version.
  6. After committing, pushing, and merging the changes, I connect to my target environment (e.g., Production).
  7. I generate the artifact using project gen-artifact -version JIRA-123 ....

The Problem: When I use project deploy with the artifact generated in the last step, it tries to deploy all objects from the project, not just the incremental changes associated with the JIRA-123 version. My expectation was that it would only apply the specific changes that project stage had identified earlier.

Here is the script I am using:

-- Define variables based on parameters
DEFINE var1 = '&1' -- dev connection name
DEFINE var2 = '&2' -- jira id
DEFINE var3 = '&3' -- prod connection name
DEFINE var4 = '&4' -- db schema
-- Show defined values
prompt 'DEV connection name: ' &var1
prompt 'Jira ID: ' &var2
prompt 'PROD connection name: ' &var3
prompt 'DB Schema: ' &var4
-- Connect to the database using the connection name
connect -name &var1
-- Pull the latest changes from the repository
!git pull
-- Create and switch to a new branch
!git checkout -b &var2
-- Export the project
project export
!pause
-- Add src folder and commit the export
!git add src
!git commit -m "Export files for jira - &var2"  
!git push -u origin &var2 --!git push origin 1.1
!pause
project stage -verbose
!pause
project release -version &var2 -verbose
-- Commit and merge the version
!git add .
!git commit -m "Version jira - &var2"
!git push origin &var2
-- Merge
!git checkout main
!git merge &var2
!pause
!git push origin main
-- Connect to PROD
connect -name &var3
!pause
-- Generate the artifact
project gen-artifact -name &var4 -version &var2 -format zip -verbose
!pause
-- Deploy the artifact
project deploy -file artifact/&var4-&var2..zip -verbose

My Question: Is my understanding of the workflow incorrect, or is my command order wrong? Does project gen-artifact always package the entire project state from the filesystem, regardless of the version tag passed to it? If so, what is the correct approach to generate an artifact or a script that contains only the incremental changes for a specific release?

Any help or clarification would be greatly appreciated.

Thank you!

Comments
Post Details
Added 5 days ago
4 comments
97 views