Skip to content

Commit

Permalink
console: ConnectionEditor choose pk based on data layout
Browse files Browse the repository at this point in the history
  • Loading branch information
absorbb committed Dec 28, 2024
1 parent 4296617 commit af733ca
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,24 @@ function ConnectionEditor({
component: (
<DataLayoutEditor
fileStorage={destinationType.id === "gcs" || destinationType.id === "s3"}
onChange={dataLayout => updateOptions({ dataLayout })}
onChange={dataLayout => {
if (existingLink) updateOptions({ dataLayout });
else {
if (dataLayout === "jitsu-legacy") {
updateOptions({
dataLayout,
primaryKey: "eventn_ctx_event_id",
timestampColumn: "_timestamp",
});
} else {
updateOptions({
dataLayout,
primaryKey: connectionOptionsZodType.parse({}).primaryKey || "message_id",
timestampColumn: "timestamp",
});
}
}
}}
value={connectionOptions.dataLayout || "segment-single-table"}
/>
),
Expand Down

0 comments on commit af733ca

Please sign in to comment.