[KEYCLOAK-11331] - MySQL support
This commit is contained in:
parent
ee82391bd2
commit
a965025be8
4 changed files with 24 additions and 2 deletions
|
@ -54,6 +54,10 @@
|
|||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-mariadb-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-mysql-deployment</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-vertx-web-deployment</artifactId>
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
<jackson.version>2.11.2</jackson.version>
|
||||
<jackson.databind.version>${jackson.version}</jackson.databind.version>
|
||||
<hibernate.version>5.4.21.Final</hibernate.version>
|
||||
<mysql-connector-java.version>8.0.21</mysql-connector-java.version>
|
||||
<picocli.version>4.5.1</picocli.version>
|
||||
<snakeyaml.version>1.20</snakeyaml.version>
|
||||
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version>
|
||||
|
@ -91,6 +92,11 @@
|
|||
<artifactId>snakeyaml</artifactId>
|
||||
<version>${snakeyaml.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql-connector-java.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
|
@ -55,6 +55,10 @@
|
|||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-mariadb</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-jdbc-mysql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-core</artifactId>
|
||||
|
|
|
@ -124,6 +124,8 @@ public final class PropertyMappers {
|
|||
return "io.quarkus.hibernate.orm.runtime.dialect.QuarkusH2Dialect";
|
||||
case "mariadb":
|
||||
return "org.hibernate.dialect.MariaDBDialect";
|
||||
case "mysql":
|
||||
return "org.hibernate.dialect.MySQL8Dialect";
|
||||
case "postgres-95":
|
||||
return "io.quarkus.hibernate.orm.runtime.dialect.QuarkusPostgreSQL95Dialect";
|
||||
case "postgres": // shorthand for the recommended postgres version
|
||||
|
@ -139,6 +141,8 @@ public final class PropertyMappers {
|
|||
return "org.h2.jdbcx.JdbcDataSource";
|
||||
case "mariadb":
|
||||
return "org.mariadb.jdbc.MySQLDataSource";
|
||||
case "mysql":
|
||||
return "com.mysql.cj.jdbc.MysqlXADataSource";
|
||||
case "postgres-95":
|
||||
case "postgres-10":
|
||||
return "org.postgresql.xa.PGXADataSource";
|
||||
|
@ -152,12 +156,14 @@ public final class PropertyMappers {
|
|||
return "h2";
|
||||
case "mariadb":
|
||||
return "mariadb";
|
||||
case "mysql":
|
||||
return "mysql";
|
||||
case "postgres-95":
|
||||
case "postgres-10":
|
||||
return "postgresql";
|
||||
}
|
||||
throw invalidDatabaseVendor(db, "h2-file", "h2-mem", "mariadb", "postgres", "postgres-95", "postgres-10");
|
||||
}, "The database vendor. Possible values are: h2-mem, h2-file, mariadb, postgres95, postgres10.");
|
||||
throw invalidDatabaseVendor(db, "h2-file", "h2-mem", "mariadb", "mysql", "postgres", "postgres-95", "postgres-10");
|
||||
}, "The database vendor. Possible values are: h2-mem, h2-file, mariadb, mysql, postgres95, postgres10.");
|
||||
create("db", "quarkus.datasource.jdbc.transactions", (db, context) -> "xa", null);
|
||||
create("db.url", "db", "quarkus.datasource.jdbc.url", (db, context) -> {
|
||||
switch (db.toLowerCase()) {
|
||||
|
@ -170,6 +176,8 @@ public final class PropertyMappers {
|
|||
case "postgres-95":
|
||||
case "postgres-10":
|
||||
return "jdbc:postgresql://${kc.db.url.host:localhost}/${kc.db.url.database:keycloak}${kc.db.url.properties:}";
|
||||
case "mysql":
|
||||
return "jdbc:mysql://${kc.db.url.host:localhost}/${kc.db.url.database:keycloak}${kc.db.url.properties:}";
|
||||
}
|
||||
return null;
|
||||
}, "The database JDBC URL. If not provided a default URL is set based on the selected database vendor. For instance, if using 'postgres-10', the JDBC URL would be 'jdbc:postgresql://localhost/keycloak'. The host, database and properties can be overridden by setting the following system properties, respectively: -Dkc.db.url.host, -Dkc.db.url.database, -Dkc.db.url.properties.");
|
||||
|
|
Loading…
Reference in a new issue