Skip to content

Commit 7f33b8d

Browse files
authored
fix: Make cq_id non required on destination (#799)
<!-- Explain what problem this PR addresses --> ---
1 parent 595c9b5 commit 7f33b8d

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

plugins/destination/plugin.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,15 @@ func checkDestinationColumns(schemas schema.Schemas) error {
285285
if !sc.HasField(schema.CqSyncTimeColumn.Name) {
286286
return fmt.Errorf("table %s is missing column %s. please consider upgrading source plugin", schema.TableName(sc), schema.CqSourceNameField.Name)
287287
}
288-
if !sc.HasField(schema.CqIDColumn.Name) {
289-
return fmt.Errorf("table %s is missing column %s. please consider upgrading source plugin", schema.TableName(sc), schema.CqIDColumn.Name)
290-
}
291-
fields, _ := sc.FieldsByName(schema.CqIDColumn.Name)
292-
cqID := fields[0]
293-
if cqID.Nullable {
294-
return fmt.Errorf("column %s.%s cannot be nullable. please consider upgrading source plugin", schema.TableName(sc), schema.CqIDColumn.Name)
295-
}
296-
if !schema.IsUnique(cqID) {
297-
return fmt.Errorf("column %s.%s must be unique. please consider upgrading source plugin", schema.TableName(sc), schema.CqIDColumn.Name)
288+
fields, ok := sc.FieldsByName(schema.CqIDColumn.Name)
289+
if ok {
290+
cqID := fields[0]
291+
if cqID.Nullable {
292+
return fmt.Errorf("column %s.%s cannot be nullable. please consider upgrading source plugin", schema.TableName(sc), schema.CqIDColumn.Name)
293+
}
294+
if !schema.IsUnique(cqID) {
295+
return fmt.Errorf("column %s.%s must be unique. please consider upgrading source plugin", schema.TableName(sc), schema.CqIDColumn.Name)
296+
}
298297
}
299298
}
300299
return nil

0 commit comments

Comments
 (0)