Skip to content

Setup development environment

Rodel E. Dagumampan edited this page Jan 12, 2022 · 31 revisions

Welcome

Hi, I am Rodel Dagumampan, maintainer of yuniql and welcome to yuniql contributor page. I am hoping you will have a light and easy start and I'll try to support you in getting started.

If this is your first time to participate in an open source initiative, you may look at issues labeled as first timer friendly issues. If you found an interesting case, you can fork this repository, clone to your dev machine, create a local branch, and make Pull Requests (PR) so I can review and merge your changes. This page best describe the process https://github.com/firstcontributions/first-contributions/blob/master/README.md.

Solution Structure

Yuniql solution can be built from main solution file Yuniql.sln. Within the solution, you can run and execute unit tests and platfor verification tests. The table below describe the purpose of each directory.

Solution/Directory Description
yuniql.sln The main solution to build Yuniql CLI with default support for SqlServer. The unit tests and extensibility interfaces for building plugins are here.
yuniql-extensibility Interfaces to implement to support a database platform. Yuniql.SqlServer, Yuniql.PostgreSql, and Yuniql.MySql all implements the interface.
yuniql-core Holds main execution engine for running database migrations.
yuniql-platforms Specific DB platform implementation are placed here. Each directory is compiled as nuget package.
yuniql-tests Contains unit tests and platform verification test projects.
yuniql-cli When built, produces the compatible yuniql.exe file or publishes .DLLs for Linux clients.
Solution/Directory Description
yuniql-aspnetcore Produces Yuniql.AspNetCore nuget package for use in .NET Core WebApp, WebApi and Worker projects.
yuniql-distribution Holds distribution of yuniql via Chocolatey or other distribution channels.
yuniql-azure-pipelines Products packages for Azure DevOps Marketplace.

Build the Solution

1. Install prerequisites

2. Fork this repository into your GitHub account

cd c:\temp
git clone {your-forked-repo-url-here}.git

3. Build the code

cd c:\temp\yuniql\yuniql-cli
dotnet build

4. Publish as an executable yuniql.exe

cd c:\temp\yuniql\yuniql-cli
dotnet publish -c release -r win-x64 /p:publishsinglefile=true /p:publishtrimmed=true

5. Test run simple migrations for sql server

Prepare your target database, here we use SqlServer on Docker

docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=P@ssw0rd!" -p 1400:1433 -d mcr.microsoft.com/mssql/server:2017-latest
SETX YUNIQL_CONNECTION_STRING "Server=localhost,1400;Database=helloyuniql;User Id=SA;Password=P@ssw0rd!"
SETX YUNIQL_PLATFORM "sqlserver"

Run migrations

cd C:\temp\yuniql\yuniql-cli\bin\release\netcoreapp3.0\win-x64\publish\

yuniql run -a -p "c:\temp\yuniql\samples\basic-sqlserver-sample"
yuniql list

5. Run all platform tests for sql server

Deploy local database container

docker run --rm -dit -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=P@ssw0rd!" -p 1400:1433 -d mcr.microsoft.com/mssql/server:2017-latest

Configure your test environment

cd C:\temp\yuniql\yuniql-cli
dotnet publish -c release -r win-x64 /p:publishsinglefile=true /p:publishtrimmed=true

SETX YUNIQL_TEST_PLATFORM "sqlserver"
SETX YUNIQL_TEST_CONNECTION_STRING "Server=localhost,1400;Database=yuniqldb;User Id=SA;Password=P@ssw0rd!"
SETX YUNIQL_TEST_SAMPLEDB "C:\temp\yuniql\samples\basic-sqlserver-sample"
SETX YUNIQL_TEST_CLI "C:\temp\yuniql\yuniql-cli\bin\release\netcoreapp3.0\win-x64\publish"
SETX YUNIQL_TEST_HOST "LOCALSERVER"

Run platform tests from cli

cd C:\temp\yuniql\yuniql-tests\platform-tests
dotnet test -v n
dotnet test --filter Test_Init -v n

Further readings

https://github.com/rdagumampan/yuniql/blob/master/yuniql-tests/platform-tests/README.md

Found bugs?

Help us improve further please create an issue.