schema/field: support annotating fields as deprecated (#4132)

This commit is contained in:
Ariel Mashraki
2024-07-10 15:55:37 +03:00
committed by GitHub
parent db2088c34a
commit 7871b82e81
14 changed files with 385 additions and 65 deletions

View File

@@ -49,7 +49,9 @@ in the LICENSE file in the root directory of this source tree.
{{ $.ID.Constant }},
{{- end }}
{{- range $f := $.Fields }}
{{ $f.Constant }},
{{- if not $f.IsDeprecated }}
{{ $f.Constant }},
{{- end }}
{{- end }}
}
{{/* If any of the edges owns a foreign-key */}}
@@ -92,6 +94,13 @@ func ValidColumn(column string) bool {
}
}
{{- end }}
{{- with $.DeprecatedFields }}
for _, f := range [...]string{ {{- range . }}{{ .Constant }},{{ end }} } {
if column == f {
return true
}
}
{{- end }}
return false
}
{{ end }}