6.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.
-
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 cicdThis command creates a project in the current working directory called
demounder 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.
-
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
projectcommands. The files for the configuration are stored under the.dbtoolsfolder. In the configuration, there are a number of settings that can be configured.project config -listThis 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
-verboseoption 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
projectcommand is used. -
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
stagecommand 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 initcommand.project exportYou 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
stagecommand is used along with theexportcommand. 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 adistfolder.src dist - -releases -next - <stage files>The
stagecommand 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.
Thereleasecommand takes the contents of the dist/next folder and renames it to a given version number.project release -version 1.0And then creates a new
nextfolder under dist.Once code has been moved into a release it should never be modified. As such, it is recommended that the
releasecommand should only be run once the following criteria have been met:project verifyhas 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 nullonly to find out it hasnullvalues).
To test a pre-release build, run
project gen-artifactand use a version name such as-version 1.0.0-test. This also includes everything in thenextfolder. - 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).