Description:
When running project stage
with SQLcl 25.2.2 and generatedFormat
set to sql
in project.config.json
, the generated stage.changelog.sql
has an incorrect ordering of objects.
It starts by creating foreign keys first, and only afterwards creates the tables. This results in deployment failures since the referenced tables do not yet exist when the foreign keys are applied.
To verify, I tested with generatedFormat: liquibase
. In this case, the generated changelog.xml
has the correct ordering — tables first, then foreign keys. This shows the issue is specific to the SQL output format.
Steps to Reproduce:
- In
project.config.json
, set "generatedFormat": "sql"
.
- Run
project stage
.
- Inspect
stage.changelog.sql
.
Expected:
Tables created first, then foreign keys.
Actual:
Foreign keys come first, then tables.
Environment:
SQLcl project version: 25.2.2
Question:
Is this a bug? And if so, is there any workaround that I could use?