4.2 About the Project Command
The command in SQLcl for Database CI/CD extension is
project
. It contains several sub-commands that are
used as part of the process to help developers manage database changes and
create serialized transactions.
All project
sub-commands support
-verbose
and -debug
options, which
provide detailed processing information.
Each of the sub-commands are described below. For information about syntax and options for each sub-command, refer the SQLcl command line help.
-
init|in
Initializes a new project. This command can be run in a new Git repository or in an existing repository.
project init -name demo -makeroot -schemas cicd
This command creates a project in the current working directory called
demo
under a new folder calleddemo
. Several folders are created under the project directory including a configuration directory under.dbtools
.This folder and the files under it should be added and committed to the Git repository.
-
config|cfg
Enables you to view and manage your project configuration properties.
This command allows you to look at the current configuration that is used by each of the
project
commands. The files for the configuration are stored under the.dbtools
folder. In the configuration, there are a number of settings that can be configured.project config -list
This command lists all the configured options. Most of these options have defaults, which are used in the absence of the parameter. You can see the defaults by using the
-verbose
option withproject config -list
.You can set configuration items by using the following command:
project config set -name <configitem> -value <value> -type <value-type>
Any invalid configurations are flagged at runtime when a
project
command is used. -
export|ex
Exports database objects into your repository.
As a rule, when exporting from the database, a new branch is created. This branch is used when using the
stage
command to compare with previous branches to generate the DDL statements. You can run the following command in the project to export the objects owned by the schemas identified in theproject init
command.project export
You can also choose to export a specific schema, or even an object.
In the configuration files, there is a specific file for filtering objects that can be modified to clearly identify the correct objects to export.
Export supports normal database objects supported by DBMS_METADATA and also APEX applications. See the DBMS_METADATA: Object Types table in Oracle Database PL/SQL Packages and Types Reference.
- stage|st
Creates Liquibase changelogs or changesets for all source files and custom SQL files.
The
stage
command is used along with theexport
command. This command takes the current branch and compares it to the base branch and generates the changelogs that will apply those changes to a database. The command creates a folder in a specific format with adist
folder.src dist - -releases -next - <stage files>
The
stage
command can also be used to add other custom changesets as part of the change. This generates a file to add SQL and SQLcl commands with a Liquibase SQL changeset header. This file will be added to the changelog hierarchy automatically. - release|re
Moves the current set of work into a release state and starts a new body of work.
Therelease
command takes the contents of the dist/next folder and renames it to a given version number.project release -version 1.0
And then creates a new
next
folder under dist.Once code has been moved into a release it should never be modified. As such, it is recommended that the
release
command should only be run once the following criteria have been met:project verify
has successfully ran.- Test the release against various
systems:
- Build system: This confirms that all DDL and code compiles correctly.
- Test system (with data): Confirms
that no data integrity issues (For example: Making
a column
not null
only to find out it hasnull
values).
To test a pre-release build, run
project gen-artifact
and use a version name such as-version 1.0.0-test
. This also includes everything in thenext
folder. - gen-artifact|ga
Generates an artifact representing the current state of your project.
- deploy|dp
Deploys the artifact on a target database.
- verify|v
Provides the means to test various aspects of your project (snapshots, changes, overall project).