Skip to content

Commit

Permalink
fix(jdbc): compatible with Postgres 14 (#5019)
Browse files Browse the repository at this point in the history
close #4825
  • Loading branch information
Skraye committed Sep 23, 2024
1 parent 1f2c87a commit 07a10f3
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

import io.kestra.core.models.topologies.FlowTopology;
import io.kestra.jdbc.repository.AbstractJdbcFlowTopologyRepository;
import io.kestra.jdbc.repository.AbstractJdbcRepository;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.inject.Singleton;
import org.jooq.DMLQuery;
import org.jooq.DSLContext;
import org.jooq.Record;

@Singleton
@PostgresRepositoryEnabled
Expand All @@ -13,4 +17,14 @@ public class PostgresFlowTopologyRepository extends AbstractJdbcFlowTopologyRepo
public PostgresFlowTopologyRepository(@Named("flowtopologies") PostgresRepository<FlowTopology> repository) {
super(repository);
}

@Override
protected DMLQuery<Record> buildMergeStatement(DSLContext context, FlowTopology flowTopology) {
return context.insertInto(this.jdbcRepository.getTable())
.set(AbstractJdbcRepository.field("key"), this.jdbcRepository.key(flowTopology))
.set(this.jdbcRepository.persistFields(flowTopology))
.onConflict(AbstractJdbcRepository.field("key"))
.doUpdate()
.set(this.jdbcRepository.persistFields(flowTopology));
}
}

0 comments on commit 07a10f3

Please sign in to comment.