Browse Source

[Bug] Fix TriggerRelationMapper cannot work due to miss DatabaseIdProvider (#15153)

3.2.1-prepare
destroydestiny 1 year ago committed by GitHub
parent
commit
36f72056a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoConfiguration.java
  2. 2
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TriggerRelationMapper.xml

8
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/DaoConfiguration.java

@ -24,6 +24,9 @@ import org.apache.dolphinscheduler.dao.plugin.api.DaoPluginConfiguration;
import org.apache.dolphinscheduler.dao.plugin.api.dialect.DatabaseDialect;
import org.apache.dolphinscheduler.dao.plugin.api.monitor.DatabaseMonitor;
import org.apache.ibatis.mapping.DatabaseIdProvider;
import org.apache.ibatis.mapping.VendorDatabaseIdProvider;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -61,6 +64,11 @@ public class DaoConfiguration {
return interceptor;
}
@Bean
public DatabaseIdProvider databaseIdProvider() {
return new VendorDatabaseIdProvider();
}
@Bean
public DbType dbType() {
return daoPluginConfiguration.dbType();

2
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TriggerRelationMapper.xml

@ -53,7 +53,7 @@
ON DUPLICATE KEY UPDATE update_time = #{triggerRelation.updateTime};
</insert>
<insert id="upsert" databaseId="pg">
<insert id="upsert" databaseId="PostgreSQL">
INSERT INTO t_ds_trigger_relation (trigger_code, trigger_type, job_id, create_time, update_time) VALUES(
#{triggerRelation.triggerCode},#{triggerRelation.triggerType},#{triggerRelation.jobId},#{triggerRelation.createTime},#{triggerRelation.updateTime})
ON CONFLICT(trigger_type,job_id,trigger_code) DO UPDATE SET update_time = #{triggerRelation.updateTime};

Loading…
Cancel
Save