mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
dialect/sql/schema: support setting default value expressions on id fields (#3089)
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
@@ -1102,3 +1103,16 @@ func (a *Atlas) legacyMigrate() (*Migrate, error) {
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// removeAttr is a temporary patch due to compiler errors we get by using the generic
|
||||
// schema.RemoveAttr function (<autogenerated>:1: internal compiler error: panic: ...).
|
||||
// Can be removed in Go 1.20. See: https://github.com/golang/go/issues/54302.
|
||||
func removeAttr(attrs []schema.Attr, t reflect.Type) []schema.Attr {
|
||||
f := make([]schema.Attr, 0, len(attrs))
|
||||
for _, a := range attrs {
|
||||
if reflect.TypeOf(a) != t {
|
||||
f = append(f, a)
|
||||
}
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user