mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
schema/field: support annotating fields as deprecated (#4132)
This commit is contained in:
@@ -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 }}
|
||||
|
||||
Reference in New Issue
Block a user