Yuniql CLI Command Reference

Command Line Interface (CLI) commands and parameters.

Yuniql CLI is powerful interface to prepare and run migrations from developer’s IDE, DBA’s machine or thru continuous integration server. Database developers can follow these CLI sequence calls to prepare local db version before commiting to git repository:

  • yuniql init / initializes db project structure
  • yuniql run / runs migrations
  • yuniql list / shows existing versions applied
  • yuniql erase / cleans up when done local testing
yuniql init

Creates baseline directory structure that serves as your database migration workspace. Commit this into your preferred source control platform such as git, tfs vc or svn.

yuniql init [-p|--path] [-d|--debug] [--help]
  • -p "c:\temp\demo" | --path "c:\temp\demo"

    Creates initial directory structure in the target directory. Defaults to current directory of the CLI.

  • -d | --debug

    Runs command with DEBUG tracing enabled.

  • --help

    Shows the CLI command reference on screen.

yuniql run

Inspects the target database and creates the required table to track the versions. All script files in _init directory will be executed on first run. The order of execution is as follows _init,_pre,vx.xx,_draft,_post. Several variations on how we can run migration are listed below.

yuniql run [-p|--path] [-c|--connection-string] [-a|--auto-create-db] [-t|--target-version] 
    [-k|--token] [--platform] [--environment] [--bulk-separator] [--bulk-batch-size] [--command-timeout] 
    [--meta-schema] [--meta-table] [--continue-after-failure] [-d|--debug]
  • -p "c:\temp\demo" | --path "c:\temp\demo"

    Runs migration from target directory. Defaults to current directory of the CLI.

  • -c "<value>" | --connection-string "<value>"

    Runs migration using the specified connection string. Defaults to environment variable YUNIQL_CONNECTION_STRING. See environment variables.

  • -a | --auto-create-db

    Creates target database if the database does not exists. Defaults to false.

  • --platform "postgresql"

    Runs migration targetting PostgreSql database. Defaults to sqlserver. See supported platforms.

  • -t "v1.05" | --target-version "v1.05"

    Runs migration only up to the version v1.05 skipping v1.06 or later. Defaults to latest available version locally.

  • -k "<key>=<value>,<key>=<value>" | --token "<key>=<value>,<key>=<value>"

    Replace each tokens in each script file. This is very helpful when you have environment specific sql-statements such as cross-server queries where database names are suffixed by the environment.

  • --bulk-separator ";"

    Runs bulk import of CSV files using ; as bulk values separator. Defaults to ;;

  • --bulk-batch-size "300"

    Bulk import batch size for platforms supporting batch rows.. Defaults to 0;

  • --environment "DEV"

    Environment code for environment-aware scripts.

  • --command-timeout 120

    The time in seconds to wait for the each command to execute. Defaults to 30 secs.

  • --meta-schema

    Schema name for schema versions table.

  • --meta-table

    Table name for schema versions table.

  • --continue-after-failure

    Skip failed script and continue with migration (Only for platforms which doesn’t fully support transactions

  • -d | --debug

    Runs command with DEBUG tracing enabled. Prints raw sql statements before their execution.

  • --help

    Shows the CLI command reference on screen.

yuniql list

Shows all version currently present in the target database.

yuniql list [-p|--path] [-c|--connection-string] [--platform] [--command-timeout] [-d|--debug]
  • -p "c:\temp\demo" | --path "c:\temp\demo"

    Runs command from target directory. Defaults to current directory of the CLI.

  • -c "<value>" | --connection-string "<value>"

    Runs command using the specified connection string. Defaults to environment variable YUNIQL_CONNECTION_STRING. See environment variables.

  • --platform "postgresql"

    Runs command targetting PostgreSql database. Defaults to sqlserver. See supported platforms.

  • --command-timeout 120

    The time in seconds to wait for the each command to execute. Defaults to 30 secs.

  • -d | --debug

    Runs command with DEBUG tracing enabled. Prints raw sql statements before their execution.

  • --help

    Shows the CLI command reference on screen.

yuniql erase

Discovers and executes all scripts placed in the _erase directory. This is especially useful in dev and test environment where teams cannot auto-create new database each test case. The execution is immutable and enclosed in single transaction. The list of objects to drop, the order of when they will be dropped must be manually prepared.

NOTE: Yuniql does not automatically create drop scripts but instead rely on users to prepare the appropriate way of clearing the database objects. With this, you can segment environment-specific clean-up scripts; example is when you may not want to drop permissions in DB when you are performing integration tests.

yuniql erase [-p|--path] [-c|--connection-string]  [-k|--token] [--platform] [--command-timeout] [--force] [-d|--debug]
  • -p "c:\temp\demo" | --path "c:\temp\demo"

    Runs command from target directory. Defaults to current directory of the CLI.

  • -c "<value>" | --connection-string "<value>"

    Runs command using the specified connection string. Defaults to environment variable YUNIQL_CONNECTION_STRING. See environment variables.

  • --platform "postgresql"

    Runs command targetting PostgreSql database. Defaults to sqlserver. See supported platforms.

  • --force

    Runs erase command without asking for confirmation. [Not yet implemented].

  • --command-timeout 120

    The time in seconds to wait for the each command to execute. Defaults to 30 secs.

  • -d | --debug

    Runs command with DEBUG tracing enabled. Prints raw sql statements before their execution.

  • --help

WARNING: Be very careful when using this function as it has SEVERE consequences when run in PRODUCTION. Make sure to remove this pipeline task if you are cloning CI/CD pipelines from your DevOps tool.

yuniql vnext

Identifies the latest version locally and increments the minor version with the format v{major}.{minor}. The command just helps keeping the semantic consistent and this can also be done manually.

yuniql vnext [-p|--path] [-M|--major] [-m|--minor] [-f|--file] [-d|--debug] 
  • -p "c:\temp\demo" | --path "c:\temp\demo"

    Creates new version in the target directory. Defaults to current directory of the CLI.

  • -m | --minor

    Increments major version by creating vx.xx+1 folder. Default when not passed.

  • -M | --major

    Increments minor version by creating vx+1.xx folder.

  • -f | --file <file-name.sql>

    Creates an empty sql file in the created major or minor version.

  • -d | --debug

    Runs command with DEBUG tracing enabled.

  • --help

    Shows the CLI command reference on screen.

yuniql verify

Checks if all your versions can be executed without errors. It runs through all the non-versioned script folders (except _init) and all migration steps that yuninql run takes but without committing the transaction. All changes are rolled-back after a successful verification run.

yuniql verify [-p|--path] [-c|--connection-string] [-t|--target-version] 
    [-k|--token] [--bulk-separator] [--platform] [--command-timeout] [--environment] [-d|--debug]

NOTE: Because it relies on an existing database, you can only use verify on database already baselined or versioned.

yuniql version

Shows the current version of yuniql CLI running.

yuniql version

Learn further

Found bugs?

Help us improve further please create an issue.

Comments