Redgate Change Control

RCC versions from v3.26

The Redgate Change Control command line and Docker containers are still in preview and the API is therefore still subject to change.

When installing Redgate Change Control, the command line executable will be automatically added to the PATH environment variable so it can be used directly from your console, for instance by running rcc --helpThe docker image can be obtained from here

Verbs

The verbs provided by the command line are defined in multi-level groups according to their behaviour.


In addition to the specific parameters described below, each of the verbs also takes an additional set of common arguments:

ShortLongRequiredDescription

--IAgreeToTheEula

REQUIRED

By using this option you consent to the Redgate EULA.

-v--verbose

OPTIONAL

Increase logging output for debugging purposes.
-q--quiet

OPTIONAL

Suppress logging output except for error messages.
-f--format

OPTIONAL

Specify the format of the output. If not set, the default is to provide a human-readable output and to print log messages as they happen. If set to "json", the output will be a JSON object and any log messages will be stored in that object.

Currently the human-readable format has not yet been implemented so all data is returned as json.

Project Verbs

These verbs perform actions related to the overall project, such as creation or updating of settings.

project init

Creates a new Redgate Change Control project configuration file based on the supplied parameters.

Arguments
ShortLongRequiredDescription
-l--projectLocation

REQUIRED

Path to the directory in which to initialize the project.
-n--projectName

REQUIRED

Name of the project to initialize.
-m--migrationsLocation

REQUIRED

Path to the directory where the migration scripts will be kept.

--devSourceType

REQUIRED

The type of the development source. This can be "Database" or "ScriptsSource" (if using a Source Control for Oracle project).
-s--schemas

REQUIRED

Comma-separate list of database schemas to include in the project.
-f--force

OPTIONAL

Flag to indicate whether to overwrite an existing project configuration file in the project location if it exists.

--devUsername

CONDITIONAL

The username to use connect to the development database (Required if --devSourceType  is "Database").

--devPassword

CONDITIONAL

The password to use to connect to the development database (Required if --devSourceType is "Database").

--shadowUrl

REQUIRED

The jdbc url for the shadow database.

--shadowUsername

REQUIRED

The username to use connect to the shadow database.

--shadowPassword

REQUIRED

The password to use to connect to the shadow database.
Output

A json object with the following structure:

{
  path: string,         -- Absolute path to the project .conf file.
  projectId: string     -- A GUID representing the unique project ID (also saved in the .conf file).
}  


This command writes per-user settings to a settings folder in the user's home directory. For the docker container, you'll need to create this file yourself or modify the main project file with the dev/shadow details. See Creating a new project for more details on per-user settings.

project update

Updates the Redgate Change Control project configuration file with the specified values.

Arguments
ShortLongRequiredDescription
-P--project

REQUIRED

The path to the project's *.conf configuration file.


--devUrl

OPTIONAL

The new jdbc url for the development database.


--shadowUrl

OPTIONAL

The new jdbc url for the shadow database.


--devUsername

CONDITIONAL

Username for the development database connection.  It can be specified here or in the environment variable RCC_DEV_USERNAME.


--devPassword

CONDITIONAL

Password for the development database connection. It can be specified here or in the environment variable RCC_DEV_PASSWORD.

Output

There is no output from this verb.

Migration Verbs

These are verbs specifically used for actions related to generation and management of migration scripts. For instance, these verbs provide the ability to run comparisons, generate migration scripts and save them to the project.

migration generate-baseline

Creates a baseline migration script based on a given target database schema and saves it to the project. If working with a development database, this command will also run flyway baseline to set the schema version. 

Arguments
ShortLongRequiredDescription
-P--project

REQUIRED

The path to the project's *.conf configuration file.

-t--target

REQUIRED

The jdbc url for the target database to use to calculate the baseline script.

--targetUsername

REQUIRED

Username for the target database connection - can be specified here or in the environment variable RCC_TARGET_USERNAME.


--targetPassword

REQUIRED

Password for the target database connection - can be specified here or in the environment variable RCC_TARGET_PASSWORD.


--devUsername

CONDITIONAL

Username for the development database connection (Required if using a development database) - can be specified here or in the environment variable RCC_DEV_USERNAME.


--devPassword

CONDITIONAL

Password for the development database connection (Required if using a development database) - can be specified here or in the environment variable RCC_DEV_PASSWORD.


--shadowUsername

CONDITIONAL

Username for the shadow database connection. It can be specified here or in the environment variable RCC_SHADOW_USERNAME.


--shadowPassword

CONDITIONAL

Password for the shadow database connection. It can be specified here or in the environment variable RCC_SHADOW_PASSWORD.

-b--baselineVersion

REQUIRED

The schema version to set the baseline to.

-d--baselineDescription

REQUIRED

The name for the baseline migration script, excluding .sql.

-f--force

OPTIONAL

Flag to indicate where to overwrite any existing baseline script.

Output

A json object with the following structure:

{
  path: string,                 -- Absolute path to the baseline .sql migration file saved in the project.
}  

migration compare

Compares databases or scripts folders (generated by Source Control for Oracle) to determine a set of changes that can be scripted out.

Arguments
ShortLongRequiredDescription
-P--project

REQUIRED

The path to the project's *.conf configuration file.


--devUsername

CONDITIONAL

Username for the development database connection (Required if using development database) - can be specified here or in the environment variable RCC_DEV_USERNAME.


--devPassword

CONDITIONAL

Password for the development database connection (Required if using development database) - can be specified here or in the environment variable RCC_DEV_PASSWORD.


--shadowUsername

CONDITIONAL

Username for the shadow database connection. It can be specified here or in the environment variable RCC_SHADOW_USERNAME.


--shadowPassword

CONDITIONAL

Password for the shadow database connection. It can be specified here or in the environment variable RCC_SHADOW_PASSWORD.

Output

A json object with the following structure:

{
  databaseComparison: [
    {
      id: string,             -- The comparison id of the difference
      differenceType: string, -- The type of the comparison difference (e.g. "only in source", "only in target", "equal", "different")
      objectType: string,     -- The type of the object (e.g. "Function" or "StoredProcedure")
      objectInSource: {
        name: string,         -- The name of the database object
        schema: string,       -- The database schema of the database object
        definition: string    -- The sql definition of the database object
      },                      -- The object as it exists in the source database
      objectInTarget: {
        name: string,         -- The name of the database object
        schema: string,       -- The database schema of the database object
        definition: string    -- The sql definition of the database object
      },                      -- The object as it exists in the target database
    }
  ],
  reconnectionDetails: {
    dev: string,              -- The absolute path to the source database snapshot file
    shadow: string,           -- The absolute path to the target database snapshot file
  }
}  

This command creates snapshots of the database state and stores them in a temporary folder. These snapshots get reused for the generate command, so when using the docker container, you currently need to create a volume bind for the /tmp folder. This ensures the database snapshots are persisted between calls to the rcc CLI.


migration generate

Generates a set of migration scripts based on the changes selected from the comparison output.

Arguments
ShortLongRequiredDescription
-P--project

REQUIRED

The path to the project's *.conf configuration file.

-s--source

REQUIRED

The path to the snapshot file representing the comparison source. This is returned from compare.

-t--target

REQUIRED

The path to the snapshot file representing the comparison target. This is returned from compare.

-c--changesToInclude

REQUIRED

Comma-separated list of changes to include when generating the scripts. The comparison difference ids are returned from compare.

-b--isBaseline

OPTIONAL

Flag to indicate if the scripts being generated are for a baseline (Default = false).

Output

A json object with the following structure:

{
  migrationScript: string,                      -- The sql definition of the migration script.
  programmableObjects: [
    {
      type: string,                             -- The type of programmable object (e.g. "Function" or "StoredProcedure").
      script: string,                           -- The sql definition of the object.
      name: string                              -- The name of the programmable object.
    }
  ],
  automaticallyIncludedDependencies: [string]   -- list of the names of the objects included automatically due to required dependencies
}  

migration save

Saves a set of migration scripts to the project. If working with a development database, this command will also update the redgate_schema_history table to mark the saved scripts as applied.

Arguments
ShortLongRequiredDescription
-P--project

REQUIRED

The path to the project's *.conf configuration file.


--devUsername

CONDITIONAL

Username for the development database connection (Required if using a development database) - can be specified here or in the environment variable RCC_DEV_USERNAME.


--devPassword

CONDITIONAL

Password for the development database connection (Required if using a development database) - can be specified here or in the environment variable RCC_DEV_PASSWORD.


--versionedMigration

OPTIONAL

JSON string representing the versioned migration to save. The JSON should have the following structure:

{
  script: string,        -- The sql definition of the script.
  version: string,       -- The version number of the migration script.
  description: string    -- The name of the migration script (excluding `.sql`).
}

--programmableObjects

OPTIONAL

JSON string representing the list of programmable objects to save. The JSON should have the following structure:

[
  {
    type: string,        -- The type of programmable object (e.g. "Function" or "StoredProcedure").
    script: string,      -- The sql definition of the object.
    name: string         -- The name of the repeatable migration script (excluding `.sql`).
  }
]
Output

A json object with the following structure:

{
  savedMigrationScript: string,          -- The absolute path to the saved migration script.
  createdProgrammableObjects: [string]   -- List of absolute paths to all newly-created repeatable migration scripts.
  modifiedProgrammableObjects: [string]  -- List of absolute paths to all modified repeatable migration scripts.
  removedProgrammableObjects: [string]   -- List of absolute paths to all deleted repeatable migration scripts.
}  

migration apply

Deploys migration scripts that were written outside Redgate Change Control and manually added to the project directly to the development database. This command is only available when working with a development database.

Arguments
ShortLongRequiredDescription
-P--project

REQUIRED

The path to the project's *.conf configuration file.


--devUsername

REQUIRED

Username for the development database connection - can be specified here or in the environment variable RCC_DEV_USERNAME.


--devPassword

REQUIRED

Password for the development database connection - can be specified here or in the environment variable RCC_DEV_PASSWORD.

Output

There is no output from this verb.

migration repair

Repairs the schema history table in the development database. This can be used to assist with repairing the history table after a failed migration, or an external change to the migrations in your project.

Arguments
ShortLongRequiredDescription
-P--project

REQUIRED

The path to the project's *.conf configuration file.


--devUsername

REQUIRED

Username for the development database connection - can be specified here or in the environment variable RCC_DEV_USERNAME.


--devPassword

REQUIRED

Password for the development database connection - can be specified here or in the environment variable RCC_DEV_PASSWORD.

Output

There is no output from this verb.

migration status

Retrieves the migration and validation status of the project.

Arguments
ShortLongRequiredDescription
-P--project

REQUIRED

The path to the project's *.conf configuration file.


--devUsername

REQUIRED

Username for the development database connection - can be specified here or in the environment variable RCC_DEV_USERNAME.


--devPassword

REQUIRED

Password for the development database connection - can be specified here or in the environment variable RCC_DEV_PASSWORD.

Output

A json object with the following structure:

{
  total: number			-- Count of the total number of migrations in the project
  pending: number		-- Count of the number of pending migrations in the project
  failed: number		-- Count of the number of failed migrations in the project
  successful: number	-- Count of the number of successful migrations in the project
  future: number		-- Count of the number of future migrations in the project
  missing: number		-- Count of the number of missing migrations in the project
  repeatable: number	-- Count of the number of repeatable migrations in the project
  undo: number			-- Count of the number of undo migrations in the project
  versioned: number		-- Count of the number of versioned migrations in the project
  validationError: bool -- Whether an error occurred during validation
}  

General Verbs

These are verbs that provide high-level behaviours that are not specific to the project or migrations.

version

Prints the version information for RCC and Flyway. No additional arguments are required.

Output

A json object with the following structure:

{
  rccVersion: string	-- The version of RCC
  flywayVersion: string	-- The version of Flyway used by RCC
}  

Didn't find what you were looking for?