Skip to content

Commit caf7f92

Browse files
authored
feat: Allow skipping PK components mismatch validation (#2115)
#### Summary This should allow us to control when we want to fix the issue seen in the PR here cloudquery/cloudquery-private#7015 ---
1 parent 55f32d4 commit caf7f92

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

schema/table.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ type Table struct {
102102
// This relates to the CloudQuery plugin itself, and should not be confused
103103
// with whether the table makes use of a paid API or not.
104104
IsPaid bool `json:"is_paid"`
105+
106+
// IgnorePKComponentsMismatchValidation is a flag that indicates if the table should skip validating usage of both primary key components and primary keys
107+
IgnorePKComponentsMismatchValidation bool `json:"ignore_pk_components_mismatch_validation"`
105108
}
106109

107110
var (

transformers/tables.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func TransformTables(tables schema.Tables) error {
2626
if err := TransformTables(table.Relations); err != nil {
2727
return err
2828
}
29-
if len(table.PrimaryKeys()) > 0 && len(table.PrimaryKeyComponents()) > 0 {
29+
if !table.IgnorePKComponentsMismatchValidation && len(table.PrimaryKeys()) > 0 && len(table.PrimaryKeyComponents()) > 0 {
3030
return fmt.Errorf("primary keys and primary key components cannot both be set for table %q", table.Name)
3131
}
3232
}

0 commit comments

Comments
 (0)