Flyway 默认不支持达梦数据库,网上的教程改起来着实麻烦,索性就自己发布一个包来一劳永逸。
Maven 引入 flyway 和 达梦JDBC驱动,额外引入 db-migration-dm 包:
<dependency>
<groupId>com.github.mengweijin</groupId>
<artifactId>db-migration-dm</artifactId>
<version>${db-migration-dm.version}</version>
</dependency>
<dependency>
<artifactId>flyway-core</artifactId>
<groupId>org.flywaydb</groupId>
</dependency>
db-migration-dm 版本说明(达梦)
db-migration-dm | spring boot | flyway | liquibase |
---|---|---|---|
✖ | spring boot 版本 < 2.6.2 | 版本 < 7.15.0 | 版本 < 4.5.0(未测试) |
1.1.6 | 版本 >= 7.15.0 ✔ | ||
1.1.6 | 2.6.x | 8.0.5 ✔ | 4.5.0(未测试) |
1.1.6 | 2.7.x | 8.5.13 ✔ | 4.9.1 ✔ |
1.1.6 | 3.0.x | 9.5.1 ✔ | 4.17.2 ✔ |
1.1.6 | 3.1.x | 9.16.3 ✔ | 4.20.0 ✔ |
开源代码 Gitee:https://gitee.com/mengweijin/db-migration
开源代码 Github:https://github.com/mengweijin/db-migration
SpringBoot 参考配置:
注意:DM 数据库 url 请勿添加如下参数:comOracle=true&databaseProductName=Oracle&compatibleMode=oracle
spring:
datasource:
driver-class-name: dm.jdbc.driver.DmDriver
url: jdbc:dm://localhost:5236
username: test
password: test123456
flyway:
enabled: true
baseline-on-migrate: true
placeholder-replacement: false
locations:
- classpath:db/migration/dm