Closed grinay closed 1 year ago
We don't (currently) support mssql in our migrations, but we'd take PRs. A model for creating a PR is here for the team that added MySQL compatibility. https://github.com/p2-inc/keycloak-orgs/pull/41
@xgp so fast response. Ok, I'm not java developer. Hope someone helps to make these migrations.
@grinay Understood, but I think you're 99% of the way there by just knowing the fixes. There is no Java required to make the migrations work. Everything is done in the Liquibase changelog files (https://github.com/p2-inc/keycloak-orgs/tree/main/src/main/resources/META-INF). Look at an example from how the team that added MySQL did it: https://github.com/p2-inc/keycloak-orgs/pull/41/files#diff-426463610480e06ccaf5eb2286686991c4a9e62f6b1b9ade38f437e3f4f13099R4
TBH, I knew nothing about Liquibase until I built this extension for Keycloak, but I found it not to hard to figure out, as basically everything is just a wrapper on top of SQL.
Hope someone helps to make these migrations.
Given what I've seen, that is low likelihood. Companies that use this extension either build and contribute them (e.g. like Fastly for the MySQL compatibility), or our paying customers require them.
@xgp here it is https://github.com/p2-inc/keycloak-orgs/pull/57
Amazing! Thank you so much @grinay ! I will test these in the next few days. I need to test incremental migrations with the other supported database types to make sure there will not be an error/regression when existing deployments upgrade.
Also, for testing mssql, do you have a method that uses docker images for sql server?
Looks like it's possible to use these https://mcr.microsoft.com/en-us/product/mssql/server/about
@xgp I'm using https://hub.docker.com/_/microsoft-azure-sql-edge it's the same mssql. And also original version https://hub.docker.com/_/microsoft-mssql-server. The only thing is the last one doesn't work on ARM. But edge version is working.
@grinay what do your connection parameters look like? I'm getting the following error:
Could not obtain connection to query metadata: com.microsoft.sqlserver.jdbc.SQLServerException: The driver could not establish a secure connection to SQL Server by using Secure Sockets Layer (SSL) encryption. Error: "PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
@xgp I had similar issue, Something to do with encryption. ENV KC_DB_URL=jdbc:sqlserver://$KC_DB_HOSTNAME:1433;databaseName=$KC_DB_NAME;characterEncoding=UTF-8;encrypt=true;trustServerCertificate=true;trustStore=/etc/pki/java/cacerts;trustStorePassword=changeit So we have to add generated certificates. Also build with this command RUN /opt/keycloak/bin/kc.sh build --db=mssql --transaction-xa-enabled=false
Hello i've build the latest v0.23 version and tried to use in keyclock 21.0.2 which connected to mssql database. On run it fails to apply migrations: jpa-changelog-phasetwo-20211207.xml
jpa-changelog-phasetwo-20211208.xml
To fix that I had to manually apply some queries to tables:
After that migrations finished.