Skip to Main Content

SQLcl

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

SQLcl Project - Problem with liquibase compile order

Hi,

I'm working to integrate my database development process with SQLcl.

Right now, I don't find any documentation on how to change liquibase default order. Right now, when i export and stage, my stage.changelog.xml contains all my changes. The problem is that the order of objects seems wrong. For example, tables are compiled at the end after constraints or package bodies are compiled before package specs.

Can I specify somewhere to liquibase the default compiling order for my objects?

When seeking the solution I came across this option in project.config.json :

"stage" : { 
	...
	"changeLogSortOrder" : [ "USER", "TYPE_SPECS", "TYPE_BODY", ... ] 
}

Sadly it doesn't seem to be a real parameter since project config doesn't show any description for this.

Anyone got a solution about this?

Comments

heraoui-Oracle

Can you please give me the steps that you followed to generate the stage.changelog.xml?

@hamza-eraoui-oracle thanks for the reply, I simply did the steps shown in the quick start guide.

With an SQLcl command prompt :

!git checkout -b feature-a
project export
!git add -A
!git commit -m "Post export"
project stage

The sorting of my changes was like this :

  • comments
  • package_bodies
  • package_specs
  • ref constraints
  • sequences
  • tables
  • triggers
  • views

It just seems to be the good ol' alphabetical order!

heraoui-Oracle

Hey @alex-devl

I just double-checked the Quick Start Guide again and redid the lab, but it seems to be working fine.

Can you please try again or provide the exact steps you followed so I can reproduce your issue? (use the history command in SQLcl to catch all you commands history) and send it to me .

This is my version: Oracle SQLDeveloper Command-Line (SQLcl) version: 24.4.1.0 build: 24.4.1.042.1221

Here is the steps scripted:

!mkdir demo-project
!git init --initial-branch=main
project init -name demo_project -schemas demo
!git add -all
!git commit -m "initial"
!git checkout -b ticket-1
create table dept(       deptno     number(2,0),        dname      varchar2(14),       loc        varchar2(13),       constraint pk_dept primary key (deptno)   );
create table emp(        empno      number(4,0),      ename      varchar2(10),         job        varchar2(9),      mgr        number(4,0),      hiredate   date,         sal        number
create index idx_emp_deptno on emp(deptno);
!git add -all
!git commit -m "TICKET-1: Added dept emp tables"
project stage add-custom -file-name dept-data.sql
project stage add-custom -file-name emp-data.sql
@dist/releases/next/changes/ticket-1/_custom/dept-data.sql
commit;
@dist/releases/next/changes/ticket-1/_custom/emp-data.sql
commit ;
!git add -all
!git commit -m "TICKET-1: data files"
!cat dist/releases/next/changes/ticket-1/stage.changelog.xml
!git merge "ticket-1"
!git checkout -b ticket-2
alter table emp add email varchar2(255);
project export -o emp
!git --no-pager diff src/database/demo/tables/emp.sql
!git commit -m "TICKET-2: Added emp.email"
project stage -v
!tree dist
!git add -all
!git commit -m "TICKET-2: emp.email alter commands"
create or replace function get_display_name(p_ename in emp.ename%type) return varchar2 as be return initcap(p_ename); end get_display_name; /
project export
!git add -all
!git commit -m "TICKET-2: added get_display_name"
project stage
!git add -all
!git commit -m "TICKET-2: dist changes for get_display_name"
!git checkout main
!git merge "ticket-2"
project release -version 1.0.0
!git add --all
!git status
!git commit -m "release 1.0.0"
!git tag release-1.0.0
project gen-artifact -version 1.0.0
-- connect to production
PROJECT deploy -file artifact/demo_project-1.0.0.zip -verbose
tables
select * from EMP;
danmcghan-Oracle

@alex-devl We are aware of a bug that can produce the alphabetized list of objects from the project stage command. However, the sequence of steps in the Quick Start guide shouldn't cause this bug to occur.

As far as we know, the bug occurs only when project stage add-custom is called before project stage. As I mentioned, this is a known bug and will be addressed soon.

@danmcghan-oracle sadly I didn't use the add-custom command!

# Oracle SQLcl Version 24.4.1.042.1221

@hamza-eraoui-oracle I just redid all my steps starting from main. Here is my command list. My project is an existing one with about 20 tables, packages, index, etc.

205  !git checkout main
206  !git status
207  !git checkout branch-export
208  !git checkout -b branch-export
209  project export
210  !git add -A
211  !git commit -m "Project exported"
212  project stage

Still my stage.changelog.xml look like this :

dist\releases\next\changes\branch-export\stage.changelog.xml
<?xml version="1.0" encoding="UTF-8"?> 
<databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" 
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog 
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd"> 
<include file="...\comments\....sql" relativeToChangelogFile="true"/> 
...
<include file="...\indexes\....sql" relativeToChangelogFile="true"/>
...
<include file="...\package_bodies\....sql" relativeToChangelogFile="true"/> 
...
<include file="...\package_specs\....sql" relativeToChangelogFile="true"/>
...
<include file="...\ref_constraints\....sql" relativeToChangelogFile="true"/> 
...
<include file="...\sequences\...sql" relativeToChangelogFile="true"/> 
...
<include file="...\tables\....sql" relativeToChangelogFile="true"/> 
...
<include file="...\triggers\....sql" relativeToChangelogFile="true"/> 
...
<include file="...\views\...sql" relativeToChangelogFile="true"/> 
</databaseChangeLog>

I hope I'm just missing something simple!

danmcghan-Oracle

@alex-devl Thanks for following up. We're bumping the priority on this bug and hope to have a fix out soon.

Happy to hear that!

1 - 7

Post Details

Added on Mar 6 2025
7 comments
143 views