Released yuniql v1.2.25. Multi-tenant support, Oracle and largest set of bug fixes
Tags: yuniql, database, devops, dataengineering
Published: 2022-02-22 06:14:18

Announcing release of [yuniql](https://github.com/rdagumampan/yuniql) [v1.2.25](https://github.com/rdagumampan/yuniql/releases/tag/v1.2.25). yuniql is a database version control and migration tool. Absolute zero runtime dependencies and use plain sql script files.

Every release is special and this is not an exception. This pandemic period presents a rare opportunity to review more PRs, follow-up on reported issues, build prioritized features and fix major bugs. In fact, perhaps this is the release with the most bug-fixes! A testament of our growing usage and feedback from our community. We can only thank you all for your issue tickets and contributions. And here are the highlights:

#### Multi-tenant database support
The idea behind this popular request is to perform schema versioning on shared database where objects are segmented by schema. This would also enable developers and teams to get dedicated schema version and evolve independently while using single installation. This is more important when teams are not permitted to create and destroy databases during dev/test. Get started here https://yuniql.io/docs/get-started/

```console
yuniql run -a --meta-schema dev01 --platform sqlserver
yuniql run -a --meta-schema dev02 --platform sqlserver
yuniql run -a --meta-schema dev03 --platform sqlserver

yuniql run -a --meta-schema sales --platform sqlserver
yuniql run -a --meta-schema inventory --platform sqlserver
yuniql run -a --meta-schema manufacturing --platform sqlserver
```

#### Support Oracle Enterprise & Autonomous Database
This release comes with previous support for Oracle. The platform tests has been executed using Oracle Enterprise 12C on docker container and Oracle Autonomous Database. You can explore this feature and get started here https://yuniql.io/docs/get-started-oracle/

```console
docker run --rm -dit --name oracle  -p 1521:1521  store/oracle/database-enterprise:12.2.0.1-slim

SETX YUNIQL_PLATFORM "oracle"
SETX YUNIQL_CONNECTION_STRING "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCLCDB.localdomain)));User Id=sys;Password=Oradoc_db1;DBA Privilege=SYSDBA;"
SETX YUNIQL_WORKSPACE "C:\temp\yuniql\samples\basic-oracle-sample"

yuniql run --debug
yuniql list --debug
yuniql erase --force --debug
```

#### Quick connectivity check with `yuniql check`

Can I resolve or ping the database server? Can I establish an Sql/Odbc connection to the master or catalog database? Will my connection string work if I run the migrations on this database server? Is my service account have permissions to establish a session? I hope this simple feature helps in diagnosing migration issues quickly.

```console
yuniql check -c "Server=DESKTOP-ULR8GDO;Database=helloyuniql;Trusted_Connection=True;" -d --platform sqlserver

INF   2022-02-21 23:23:11Z   Verifying ping connectivity to server/cluster DESKTOP-ULR8GDO...
INF   2022-02-21 23:23:11Z   Ping connectivity to server/cluster DESKTOP-ULR8GDO - Successful
INF   2022-02-21 23:23:11Z   Verifying sql/odbc connectivity to master/catalog on DESKTOP-ULR8GDO...
INF   2022-02-21 23:23:11Z   Sql/odbc connectivity to master/catalog on DESKTOP-ULR8GDO - Successful
INF   2022-02-21 23:23:11Z   Verifying sql/odbc connectivity to database helloyuniql on DESKTOP-ULR8GDO...
INF   2022-02-21 23:23:11Z   Sql/odbc connectivity to database helloyuniql on DESKTOP-ULR8GDO - Successful

```

#### Drop your dev/test database with `yuniql destroy`
Warning: Needless to say, don't use this in production. Just don't. This feature enables testers to rapidly deploy test databases and destroy when the test execution completes. If `yuniql erase` is not sufficient, `yuniql destroy` might suffice. It's quite simple, you prepare the destroy scripts yourself and do the necessary handling and sequence to drop the database.

```console
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

SETX YUNIQL_CONNECTION_STRING "Server=localhost,1400;Database=helloyuniql;User Id=SA;Password=P@ssw0rd!"
SETX YUNIQL_WORKSPACE "C:\temp\yuniql\samples\basic-sqlserver-sample"
SETX YUNIQL_PLATFORM "sqlserver" 

yuniql run -a --debug
yuniql list --debug
yuniql destroy --force --debug
```

### Breaking changes
- None

### New features and enhancements
- Support multi-tenant database
- Support Oracle platform
- `yuniql check`: Basic connectivity check to the target database.
- `yuniql destroy`: Drops database using custom prepared scripts.
- `yuniql apply`: A synonym for `yuniql run` to avoid conflict in `docker run`
- `trace-silent`: Console window only log and no log files produced.
- `trace-sensitive-data`: Print secrets and connection strings into console window and log files.
- `trace-directory`: Set the directory where log files are created.
- Many many bug fixes and code improvements

### Bugs fixes

- Directory names like v10.0.0 and higher versions are not taking as latest #249
- Failed database updates should ideally fail with a non-zero exit code #198
- MSSQL/New version: SUSER_SNAME() throw an exception: String or binary data would be truncated. #201
- Providing table name for the schema version table cause error #202
- I am implementing Erease Yuniql and I get the following error **This NpgsqlTransaction has completed; it is no longer usable**, the process deletes my tables in PostgreSQL (HyperScale) but flag that error. #204
- Error when setting up multi-tenant on shared databases instance #207
- Environment-aware migration not working. #208
- -- environment argument does not work #214
- CSV import towards SQLServer with a uniqueidentifier column #239
- Fixed failing bulk import when destination tables uses Pascal case
	
### Refactorings

- Revise all test scripts to CREATE TABLE instead of CREATE PROC #221
- Run platform tests in single database and not creating database per test case #220
- Why Core is linked to SqlServer ??? #241
- dynamically extract manifest data using reflection
	https://github.com/rdagumampan/yuniql/commit/74cba91c4ef954d0493052a68a6fd0e8db6441e6

### Credits
Special thanks to @bobi591, @wahmedswl, @zwdOr20, @black-eagle17, @automada, @gfnavarro for your significant contributions in this release. Also for everyone filing issue tickets and asking questions, thanks for all your feedback.