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 Projects - Foreign key constraints referencing columns in other schemas / customized lb update

Maurice Wilhelm5 days ago

Hi everyone,

in one of my tables I have a foreign key constraint referencing a table column in a different schema (EXTERNAL_SCHEMA).

Example:

CREATE TABLE "MY_SCHEMA"."PERSONS" 
(	"PERSON_ID" NUMBER, 
	....
	"MANAGER_ID" NUMBER NOT NULL
);
ALTER TABLE "MY_SCHEMA"."PERSONS" ADD CONSTRAINT "PERSONS_FK" FOREIGN KEY ("MANAGER_ID")
	  REFERENCES "EXTERNAL_SCHEMA"."MANAGERS" ("MANAGER_ID")

With project setting “emitSchema” set to “false”, the constraint also loses the schema name of the referenced foreign table column (EXTERNAL_SCHEMA) when I export, which makes it invalid:

Is this behavior expected?

My SQLcl version is 25.4.1 from the Oracle container registry.

In addition, I am using SQLcl Projects in a pipeline to automate my deployments. For that purpose I use Liquibase update-commands with different arguments for deployments to test and production environments to make sure that specific changesets (e.g., utPLSQL packages) are not deployed to every environment. For example:

# install_test.sql
lb update ... --context-filter=TEST

# install_prod.sql
lb update ... --context-filter=PROD --label-filter=featureA

Is there a way to pass an additional argument to the SQLcl “project deploy” command to specify different “install.sql” files, or would it be possible to add an additional argument to the command in one of the future releases?

Kind regards,

Maurice

Comments
Post Details
Added 5 days ago
1 comment
60 views