Skip to content

How to run migration from Azure Devops

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

Run your database migration from Azure DevOps Pipelines. The tasks downloads package and cache it for later execution just like how Use .NET Core or Use Node tasks works. Find Yuniql on Azure DevOps MarketPlace and create these two tasks:

  1. Use YUNIQL CLI
  2. Run YUNIQL CLI

Pre-requisites

  • Windows-based Agents
  • SQL Server or Azure SQL Database

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.

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.