Skip to content

Commit 288403f

Browse files
committed
work on mysql and oracle
1 parent 17b938a commit 288403f

File tree

3 files changed

+45
-5
lines changed

3 files changed

+45
-5
lines changed

.github/workflows/dotnetpull.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ jobs:
4949
--health-timeout=10s
5050
--health-retries=10
5151
52+
mysql:
53+
image: mysql:8.0
54+
ports:
55+
- 3306:3306
56+
env:
57+
MYSQL_ROOT_PASSWORD: rootpass
58+
MYSQL_DATABASE: testdb
59+
MYSQL_USER: testuser
60+
MYSQL_PASSWORD: testpass
61+
options: >-
62+
--health-cmd="mysqladmin ping -h localhost -u root -prootpass"
63+
--health-interval=10s
64+
--health-timeout=5s
65+
--health-retries=10
66+
5267
steps:
5368
- uses: actions/checkout@v4
5469
- name: Setup .NET
@@ -68,6 +83,25 @@ jobs:
6883
run: |
6984
sudo apt-get update
7085
sudo apt-get install -y postgresql-client
86+
- name: Install Oracle client
87+
run: |
88+
sudo apt-get update
89+
sudo apt-get install -y libaio1 alien
90+
wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linux.x64-21.13.0.0.0dbru.zip
91+
wget https://download.oracle.com/otn_software/linux/instantclient/instantclient-sqlplus-linux.x64-21.13.0.0.0dbru.zip
92+
unzip instantclient-*.zip
93+
sudo mkdir -p /opt/oracle
94+
sudo mv instantclient_* /opt/oracle/instantclient
95+
export LD_LIBRARY_PATH=/opt/oracle/instantclient
96+
export PATH=$PATH:/opt/oracle/instantclient
97+
- name: Create Oracle schema
98+
run: |
99+
echo "CREATE USER test IDENTIFIED BY test DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON users;" |
100+
sqlplus -L system/oracle@//localhost:1521/XEPDB1
101+
echo "GRANT CONNECT, RESOURCE TO test;" |
102+
sqlplus -L system/oracle@//localhost:1521/XEPDB1
103+
- name: Install MySQL client
104+
run: sudo apt-get update && sudo apt-get install -y mysql-client
71105
- name: Create SQLServer database
72106
run: |
73107
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'YourStrong@Passw0rd' -Q "CREATE DATABASE [Whatever];"

src/Migrator.Tests/Providers/MySQL/MySqlTransformationProviderTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Data;
22
using Migrator.Framework;
3+
using Migrator.Providers;
34
using Migrator.Providers.Mysql;
45
using Migrator.Tests.Settings;
56
using Migrator.Tests.Settings.Config;
@@ -21,10 +22,11 @@ public void SetUp()
2122
if (string.IsNullOrEmpty(connectionString))
2223
{
2324
throw new IgnoreException("No MySQL ConnectionString is Set.");
24-
}
25+
}
26+
27+
DbProviderFactories.RegisterFactory("MySql.Data.MySqlClient", () => MySql.Data.MySqlClient.MySqlClientFactory.Instance);
2528

2629
Provider = new MySqlTransformationProvider(new MysqlDialect(), connectionString, "default", null);
27-
// _provider.Logger = new Logger(true, new ConsoleWriter());
2830

2931
AddDefaultTable();
3032
}

src/Migrator.Tests/appsettings.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
"ConnectionString": "Server=localhost;Port=5432;Database=testdb;User Id=testuser;Password=testpass;"
1414
},
1515
{
16-
"Id": "Oracle",
17-
"ConnectionString": "Data Source=localhost:1521/XEPDB1;User Id=test;Password=test"
16+
"Id": "Oracle",
17+
"ConnectionString": "Data Source=//localhost:1521/XEPDB1;User Id=test;Password=test;"
18+
},
19+
{
20+
"Id": "MySQL",
21+
"ConnectionString": "Server=127.0.0.1;Port=3306;Database=testdb;User Id=testuser;Password=testpass;"
1822
}
19-
]
23+
]
2024
}

0 commit comments

Comments
 (0)