jdbc:kingbase8://xx:54321/b?useUnicode=true&characterEncoding=UTF-8
spring.datasource.dfeformdb.driver-class-name=com.kingbase8.Driver
只使用到了bpmn,则dmn和cmmn可以排除
org.flowable
flowable-spring-boot-starter-dmn
org.flowable
flowable-spring-boot-starter-cmmn
org.flowable
flowable-dmn-engine
org.flowable
flowable-dmn-spring
org.flowable
flowable-cmmn-engine
org.flowable
flowable-cmmn-spring
配置文件
在pom.xml文件中加入金仓的依赖:
com.kingbase8
kingbase8-jdbc
8.2.0.2
com.kingbase.dialect
kingbase8
8.2.0.2
参考官方文档:
https://help.kingbase.com.cn/v8/development/client-interfaces-frame/liquibase/liquibase-2.html
找到AbstractEngineConfiguration.java,在编辑器下根据该java文件的package创建相同的包名,并将其复制到我们自己实现的工程(flowengine)相同包名下,进行修改,插入以下两行
package org.flowable.common.engine.impl;
public static Properties getDefaultDatabaseTypeMappings() {
databaseTypeMappings.setProperty("KingbaseES", "postgres");
return databaseTypeMappings;
}
修改源码DatabaseConfiguration.java
CREATE TABLE PUBLIC.FLW_EV_DATABASECHANGELOGLOCK (ID INT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR(255), CONSTRAINT PK_FLW_EV_DATABASECHANGELOGLOCK PRIMARY KEY (ID))
在\resources\META-INF\services\liquibase.database.Database配置支持的数据库
liquibase.database.core.PostgresDatabase
liquibase.database.core.SQLiteDatabase
liquibase.database.core.SybaseASADatabase
liquibase.database.core.SybaseDatabase
liquibase.database.core.KingbaseDatabase
liquibase.database.core.UnsupportedDatabase
按liquibase.database.core.PostgresDatabase增加支持的数据库类型,public class KingbaseDatabase extends PostgresDatabase
CREATE TABLE PUBLIC.FLW_EV_DATABASECHANGELOGLOCK (ID INT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR(255), CONSTRAINT PK_FLW_EV_DATABASECHANGELOGLOCK PRIMARY KEY (ID))
单独执行sql时发现,不支持datetime类型
org/flowable/eventregistry/db/liquibase/flowable-eventregistry-db-changelog.xml中
CREATE TABLE PUBLIC.FLW_EV_DATABASECHANGELOGLOCK (ID INT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED datetime, LOCKEDBY VARCHAR(255), CONSTRAINT PK_FLW_EV_DATABASECHANGELOGLOCK PRIMARY KEY (ID))
改为
CREATE TABLE PUBLIC.FLW_EV_DATABASECHANGELOGLOCK (ID INT NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP, LOCKEDBY VARCHAR(255), CONSTRAINT PK_FLW_EV_DATABASECHANGELOGLOCK PRIMARY KEY (ID))
更好的方法是,新增数据库类型。
由于kingbase8中不存在 关系 “pg_settings”,只有sys_settings,也由于调用了
@Override
public void setConnection(DatabaseConnection conn) {
super.setConnection(conn);
可以重写liquibase.datatype.core.DateTimeType
将
if (database instanceof PostgresDatabase) {
改为
if (database instanceof PostgresDatabase || database instanceof KingbaseDatabase) {
Position: 27 [Failed SQL: (0) CREATE UNIQUE INDEX PUBLIC.ACT_IDX_EVENT_DEF_UNIQ ON PUBLIC.FLW_EVENT_DEFINITION(KEY_, VERSION_, TENANT_ID_)]
因为金仓不支持liquibase自动生成的创建索引语句,不要带PUBLIC.,在KingbaseDatabase覆盖方法
@Override
public boolean getOutputDefaultSchema() {
return false;
}
参考:https://blog.csdn.net/LuoGuoHua_Xin/article/details/129898193