-
Notifications
You must be signed in to change notification settings - Fork 64
Support new db platform
Rodel E. Dagumampan edited this page Jan 1, 2022
·
17 revisions
- .NET Core 3.0+ SDK
- VSCode / VS 2019
The following steps shows how support MySql plugin was built from a new dotnet class library and how to run the platform tests to target this plugin.
- Copy the platform directory and rename (ex from postgresql-Copy into redshift_
- Rename
.csproj
file - Rename
.xml
file - Add the existing project into solution
- Rename all
.cs
files where it best fit - Edit project file properties
AssemblyName
RootNamespace
Product
Description
Documentation
- Build the project
-
Create a new project and name it
Yuniql.<YourDataPlatformName>
exYuniql.Snowflake
dotnet new classlib -o mysql
-
Use
Yuniql.Extensibility
dotnet add package Yuniql.Extensibility
-
Implement
IDataService
such asYuniql.Snowflake.SnowflakeDataService
-
Implement
IBulkImportService
such asYuniql.Snowflake.SnowflakeBulkImportService
-
Add some icons and attach LICENSE.md
- Add project reference in
Yuniql.CLI
and build the project - Update
Yuniql.Core.SUPPORTED_DATABASES
- Update
Yuniql.CLI.MigrationServiceFactory
- Update
Yuniql.CLI.DataServiceFactory
- Update
Yuniql.CLI.ManifestFactory
- Update
Yuniql.CLI\README
- Build the project
- Create platforms by copying existing test data services
- Implement new
ITestDataService
- Update
Yuniql.PlatformTest.Setup.TestDataServiceFactory
- Update
Yuniql.PlatformTest.Setup.MigrationServiceFactory
- Update
Yuniql.PlatformTest.Infrastructure.ContainerFactory
- Create a basic sample workspace in
\samples
- Update
README.md
-
reate new test project
dotnet new mstest -o unitests
-
Use
Yuniql.Core
dotnet add package Yuniql.Core
-
Test run
[TestMethod] public void TestBasicRun() { //arrange //uses the samples project in the same directory as this test project var workspacePath = Path.Combine(Directory.GetParent(Directory.GetParent(Directory.GetParent(Directory.GetParent(Environment.CurrentDirectory).ToString()).ToString()).ToString()).ToString(), "samples"); var connectionString = @$"Host=localhost;Port=5432;Username=app;Password=app;Database=yuniqldb_{Guid.NewGuid().ToString().Substring(0,4)}"; var traceService = new ConsoleTraceService(); var dataService = new MySqlDataService(traceService); dataService.Initialize(connectionString); var bulkImportService = new MySqlBulkImportService(traceService); bulkImportService.Initialize(connectionString); var testDataService = new MySqlTestDataService(dataService); //act var migrationService = new MigrationService(dataService, bulkImportService, traceService); migrationService.Run(workspacePath, null, true, tokenKeyPairs: null, verifyOnly: false); //assert testDataService.CheckIfDbExist(connectionString).ShouldBeTrue(); testDataService.CheckIfDbObjectExist(connectionString, "company").ShouldBeTrue(); testDataService.CheckIfDbObjectExist(connectionString, "company_view").ShouldBeTrue(); }
-
Prepare your database (pref with a container instance)
docker run --name mysql -e MYSQL_ROOT_PASSWORD=app -d -p 3306:3306 mysql:latest --default-authentication-plugin=mysql_native_password
-
Build latest CLI version
cd C:\temp\yuniql\yuniql-cli dotnet publish -c release -r win-x64 /p:publishsinglefile=true /p:publishtrimmed=true
-
Configure your connection string
SETX YUNIQL_TEST_PLATFORM "mysql" SETX YUNIQL_TEST_CONNECTION_STRING "Server=localhost;Port=3306;Database=yuniqldb;Uid=root;Pwd=P@ssw0rd!;" SETX YUNIQL_TEST_SAMPLEDB "C:\temp\yuniql\samples\basic-mysql-sample" SETX YUNIQL_TEST_CLI "C:\temp\yuniql\yuniql-cli\bin\release\netcoreapp3.0\win-x64\publish" SETX YUNIQL_TEST_HOST "LOCALSERVER"
-
Run the platform tests
cd yuniql-platformtests dotnet build dotnet test -v n
- Create new CI in AppVeyor and get the badge
- Update README, add new supported platform
- Add page in yuniql-web
- Add samples in yuniql-examples
- Write a blog on getting started using the samples repo
Help us improve further please create an issue.