From fcfc7113f5e1cd82a2822a85530eb96bcebfb166 Mon Sep 17 00:00:00 2001 From: codychau Date: Mon, 26 Dec 2022 12:02:31 +0800 Subject: [PATCH] Support MariaDB Native Driver (#2787) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind improvement #### What this PR does / why we need it: 引入对R2DBC的MariaDB的支持,增加例子配置 #### Special notes for your reviewer: 现在,Halo可以使用MariaDB数据库原生驱动了,摆脱MySQL驱动带来的连接问题。 - [x] 支持首次启动执行SQL脚本创建表 #### Does this PR introduce a user-facing change? ```release-note 支持 MariaDB 数据库连接 ``` --- build.gradle | 1 + src/main/resources/application-mariadb.yaml | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 src/main/resources/application-mariadb.yaml diff --git a/build.gradle b/build.gradle index 470d4a296..b77241ad9 100644 --- a/build.gradle +++ b/build.gradle @@ -92,6 +92,7 @@ dependencies { // for more. runtimeOnly 'io.r2dbc:r2dbc-h2' runtimeOnly 'com.github.jasync-sql:jasync-r2dbc-mysql:2.1.7' + runtimeOnly 'org.mariadb:r2dbc-mariadb:1.1.3' runtimeOnly 'org.postgresql:postgresql' runtimeOnly 'org.postgresql:r2dbc-postgresql' diff --git a/src/main/resources/application-mariadb.yaml b/src/main/resources/application-mariadb.yaml new file mode 100644 index 000000000..e29c94dbc --- /dev/null +++ b/src/main/resources/application-mariadb.yaml @@ -0,0 +1,9 @@ +spring: + r2dbc: + url: r2dbc:pool:mariadb://localhost:3306/halo + username: root + password: mariadb + sql: + init: + mode: always + platform: mysql