Skip to content
Rodel E. Dagumampan edited this page Dec 21, 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. No special tool or language required.
  • It's .NET Core Native. Released as a self-contained .NET Core 3.0 application, YUNIQL doesn't require any dependencies or CLR installed on the developer machine or CI/CD server. For windows, the yuniql.exe file is a ready-for-use on day 1.
  • Bulk import. Load up your master data and lookup tables from CSV files. Powerful feature when provisioning fresh developer local databases or taking large block of master data.
  • DevOps Friendly. Azure Pipeline Tasks available in Az DevOps Market Place.
  • Docker Ready. Base images to host your scripts and execute.
  • Cross-platform. Works with Windows and major Linux distros.
  • Extensible. Execute custom built C# plugins for very special action. ***
  • Open Source. Released under Apache License version 2.0. Absolutely free for personal or commercial use.

*** planned or being evaluated/developer/tested


To start using 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://ci.appveyor.com/api/projects/rdagumampan/yuniql/artifacts/yuniql-latest-win-x64.zip -OutFile  "c:\temp\yuniql\yuniql-latest-win-x64.zip"
    powershell Expand-Archive "c:\temp\yuniql\yuniql-latest-win-x64.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.