Skip to content

How to run migration from Azure Devops

Rodel E. Dagumampan edited this page Dec 21, 2019 · 24 revisions

Run your database migration from Azure DevOps Pipelines. The tasks have zero dependencies on Agent Server. Find Yuniql on Azure DevOps MarketPlace and create these two tasks:

  1. Use YUNIQL CLI
  2. Run YUNIQL CLI

Azure DevOps Pipelines (YAML)

This sample uses a SqlServer Database project available in GitHub and deploy the database into an Azure SQL Database. See https://github.com/rdagumampan/yuniql/tree/master/sqlserver-samples/visitph-db.

Pre-requisites

  • Windows-based Agents
trigger:
- master

pool:
  vmImage: 'windows-latest'

steps:
- task: UseYUNIQLCLI@0
  inputs:
    version: 'latest'

- task: RunYUNIQLCLI@0
  inputs:
    version: 'latest'
    connectionString: 'Server=tcp:<AZ-SQLSERVER>,1433;Initial Catalog=<AZ-SQLDB>;User ID=<USERID>;Password=<PASSWORD>;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;'
    workspacePath: '$(Build.SourcesDirectory)\sqlserver-samples\visitph-db'
    targetPlatform: 'SqlServer'
    additionalArguments: '--debug'

Azure DevOps Pipelines (Classic)

Use YUNIQL CLI Task

This download and installs the yuniql-cli.

  • version: The version of Yuniql CLI. If omitted, the latest version of yuniql-cli is installed. Visit the releases to get an appropriate version.

Run YUNIQL CLI Task

This runs database migration with yuniql-cli.

  • version: The version of Yuniql CLI. If omitted, the latest version of yuniql-cli is installed. Visit the releases to get an appropriate version.
  • connectionString: The connection string to your target database server.
  • workspacePath: The location of your version directories to run.
  • targetPlatform: The target database platform. Default is SqlServer.
  • autoCreateDatabase: When true, creates and configure the database in the target server for yuniql migrations.
  • targetVersion: The maximum target database schema version to run to.
  • tokenKeyValuePair: Token key/value pairs for token replacement.
  • additionalArguments: Additional CLI arguments

Found bugs?

Help us improve further please create an issue.