common/schema: check for dependencies between columns

This commit is contained in:
Vincent Bernat
2023-01-30 06:47:48 +01:00
parent 7ebb3b5a21
commit 65e3e1783a
4 changed files with 57 additions and 0 deletions

View File

@@ -38,6 +38,15 @@ func New(config Configuration) (*Component, error) {
column.Disabled = true
}
}
for _, k := range config.Disabled {
if column, ok := schema.LookupColumnByKey(k); ok {
for _, depend := range column.Depends {
if ocolumn, _ := schema.LookupColumnByKey(depend); !ocolumn.Disabled {
return nil, fmt.Errorf("column %q cannot be disabled without disabling %q", k, depend)
}
}
}
}
for _, k := range config.NotMainTableOnly {
if column, ok := schema.LookupColumnByKey(k); ok {
column.ClickHouseMainOnly = false