Professional Documents
Culture Documents
Riqi Research
Riqi Research
implementation of Liquibase
This article demonstrates how to deploy Oracle Application Express (APEX)
applications using the SQLcl implementation of Liquibase.
This is a rewrite of a Liquibase article, but using SQLcl instead of the regular
Liquibase client.
SQLcl (runOracleScript)
Assumptions
The Demo Files
Create Privileged User
Create a New APEX Workspace
Create a New APEX Application
Clean Up
Related articles.
Export to a single file and manually edit it, removing SQL*Plus-specific commands
and providing a valid split string between calls, which you would reference in the
endDelimiter attribute of the sqlFile tag.
Export to multiple files, and build a potentially complex change log to call all
the resulting files in the correct sequence.
Both options were quite frankly annoying.
The runOracleScript tag solves this buy running the named script using the SQLcl
engine, which understands most of the SQL*Plus settings and commands. This allows
you to deploy unmodified APEX workspace and application export files with just a
few minor changes to the relevant change log.
This article provides a simple example of how you might approach that.
Assumptions
This article makes some assumptions about what you have available and your
preexisting knowledge.
You already have a basic understanding of Liquibase and specificlly the SQLcl
implementation of it. If not, you would be better to start by reading this article.
You have a basic understanding of APEX, and how to manually export/import
applications.
You have a functioning APEX installation to work with.
You have a download of SQLcl 19.4 or above. You can see how to install it here.
You have a Java Runtime Environment (JRE) suitable for running SQLcl.
We are connecting to SQLcl using username/password credentials, but we could just
as easily use a secure external password store.
We will only use the runOracleScript tag for those with problematic scripts. If
could be used as full replacement for the sqlFile tag is you prefer.
The Demo Files
The demos will use the following files.
+--- normal
| +--- changelogs
| | +--- changelog_master_dev_ws.xml
| | +--- changelog_setup_demo_app_sqlcl.xml
| | +--- changelog_setup_tab1.xml
| | +--- changelog_setup_tab2.xml
| +--- scripts
| | +--- demo_app_f101.sql
| | +--- get_tab1_count.sql
| | +--- tab1.sql
| | +--- tab1_seq.sql
| | +--- tab2.sql
| | +--- tab2_seq.sql
+--- privileged
| +--- changelogs
| | +--- changelog_create_dev_workspace_sqlcl.xml
| | +--- changelog_create_dev_workspace_user.xml
| | +--- changelog_master.xml
| +--- scripts
| | +--- create_apex_priv_user.sql
| | +--- create_dev_workspace.sql
| | +--- create_dev_workspace_user.sql
| | +--- remove_apex_priv_user.sql
| | +--- remove_dev_workspace.sql
| | +--- remove_dev_workspace_user.sql
They are available from a GitHub repository (here).
The privileged and normal operations are kept in a single repository for this
demonstration, but you may wish to split the privileged operations off into a
separate repository, depending the the trust level in your organisation.
conn apex_priv_user/apex_priv_user@//localhost:1521/pdb1
Connected.
SQL>
-- >= 22.3
lb update -changelog-file
/git/oraclebase/liquibase_sqlcl_apex_demo/privileged/changelogs/changelog_master.xm
l
SQL>
-- 20.2 - 22.2
lb update -changelog
/git/oraclebase/liquibase_sqlcl_apex_demo/privileged/changelogs/changelog_master.xm
l
SQL>
-- < v20.2
lb update
/git/oraclebase/liquibase_sqlcl_apex_demo/privileged/changelogs/changelog_master.xm
l
SQL>
If you check your APEX instance, you will see the DEV_WS workspace is now present.
You can log into it with the "Dev1Workspace2!" password, then you'll be prompted to
reset it.
The "demo_app_f101.sql" file contains a really basic APEX application called "Demo
App", which we'll use to demonstrate the deployment process. The
"changelog_setup_demo_app_sqlcl.xml" change log shows how to load this file.
Similar to the workspace example, we use the runOracleScript tag to reference the
script, with the script name included as CDATA under the source tag.
CONN dev_ws/dev_ws@//localhost:1521/pdb1
-- >= 22.3
lb update -changelog-file
/git/oraclebase/liquibase_sqlcl_apex_demo/normal/changelogs/changelog_master_dev_ws
.xml
SQL>
-- 20.2 - 22.2
lb update -changelog
/git/oraclebase/liquibase_sqlcl_apex_demo/normal/changelogs/changelog_master_dev_ws
.xml
SQL>
-- < v20.2
lb update
/git/oraclebase/liquibase_sqlcl_apex_demo/normal/changelogs/changelog_master_dev_ws
.xml
SQL>
If you check your APEX instance, you will see the DEV_WS workspace now includes an
application called "Demo App".
Clean Up
The "remove_*.sql" files have been provided to allow you to clean up the demo.
Collectively they perform the following commands.