Skip to content
Rodel E. Dagumampan edited this page Dec 26, 2019 · 62 revisions

Our WIKI serve as documentation for using Yuniql. If you find outdated content, inaccurate piece or would like us to create a topic or tutorial, please let us know by creating an issue.

Why yuniql?

  • It's raw SQL. Yuniql follows database-first approach to version your database. Versions are normal directories or folders. Scripts are series of plain old .sql files. You just need basic knowledge of SQL to get started.
  • It's .NET Core Native. Released as a self-contained .NET Core 3.0 application. Yuniql doesn't require any runtime dependencies or CLR installed on the developer machine and CI/CD server. For windows, yuniql.exe is ready-for-use on day 1.
  • Bulk Import CSV. Load up your master data and lookup tables from CSV files. A powerful feature when provisioning fresh developer databases or when taking large block of master data as part of a new version.
  • DevOps Friendly. Azure Pipeline Tasks available in the Market Place. Use Yuniql task acquires a specific version of the Yuniql. Run Yuniql task runs database migrations with Yuniql CLI using version acquired earlier.
  • Cloud Ready. Platform tested for Azure SQL Database. Plugins for Amazon RDS and Google Cloud SQL are lined up for development. ***
  • Docker Support. Each project is prepared for containerized execution using Yuniql base images. A dockerized database project is a practical way to run migration on any CI/CD platform.
  • Cross-platform. Works with Windows and major Linux distros.
  • Open Source. Released under Apache License version 2.0. Absolutely free for personal or commercial use.

*** planned or being evaluated/developer/tested


Quickstart with yuniql

  1. Clone sample project

    git clone https://github.com/rdagumampan/yuniql c:\temp\yuniql
    cd c:\temp\yuniql\sqlserver-samples\visitph-db
  2. Download latest yuniql build

    powershell Invoke-WebRequest -Uri https://github.com/rdagumampan/yuniql/releases/download/latest/yuniql-cli-win-x64-latest-full.zip -OutFile  "c:\temp\yuniql\yuniql-win-x64-latest.zip"
    powershell Expand-Archive "c:\temp\yuniql\yuniql-win-x64-latest.zip" -DestinationPath "c:\temp\yuniql\sqlserver-samples\visitph-db"

    Expand-Archive requires at least powershell v5.0+ running on your machine. You may also download manually here and extract to desired directory.

  3. Set default connection string to target database

    • Using an sql account
      Server=<server-instance>,[<port-number>];Database=VisitorDB;User Id=<sql-user-name>;Password=<sql-user-password>
    • Using trusted connection
      Server=<server-instance>,[<port-number>];Database=VisitorDB;Trusted_Connection=True;

    SETX YUNIQL_CONNECTION_STRING "Server=.\;Database=VisitorDB;Trusted_Connection=True;"
  4. Run migration
    The following commands yuniql to discover the project directory, creates the target database if it doesn't exist and runs all migration steps in the order they are listed. These includes .sql files, directories, subdirectories, and csv files. Tokens are also replaced via -k parameters.

    yuniql run -a -k "VwColumnPrefix1=Vw1,VwColumnPrefix2=Vw2,VwColumnPrefix3=Vw3,VwColumnPrefix4=Vw4"
    yuniql info
    
    Version         Created                         CreatedBy
    v0.00           2019-11-03T16:29:36.0130000     DESKTOP-ULR8GDO\rdagumampan
    v1.00           2019-11-03T16:29:36.0600000     DESKTOP-ULR8GDO\rdagumampan
    v1.01           2019-11-03T16:29:36.1130000     DESKTOP-ULR8GDO\rdagumampan
  5. Verify results
    Query tables with SSMS or your preferred SQL client

    //SELECT * FROM [dbo].[Visitor]
    VisitorID   FirstName   LastName    Address  Email
    ----------- ----------- ----------- ------------------------------------------
    1000        Jack        Poole       Manila   jack.poole@never-exists.com
    1001        Diana       Churchill   Makati   diana.churchill@never-exists.com
    1002        Rebecca     Lyman       Rizal    rebecca.lyman@never-exists.com
    1003        Sam         Macdonald   Batangas sam.macdonald@never-exists.com
    1004        Matt        Paige       Laguna   matt.paige@never-exists.com

Found bugs?

Help us improve further please create an issue.