summaryrefslogtreecommitdiff
path: root/vendor/github.com/uptrace/bun/schema/table.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/uptrace/bun/schema/table.go')
-rw-r--r--vendor/github.com/uptrace/bun/schema/table.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/vendor/github.com/uptrace/bun/schema/table.go b/vendor/github.com/uptrace/bun/schema/table.go
index 7498a2bc8..8bed5ed38 100644
--- a/vendor/github.com/uptrace/bun/schema/table.go
+++ b/vendor/github.com/uptrace/bun/schema/table.go
@@ -193,10 +193,15 @@ func (t *Table) initFields() {
}
}
if len(t.PKs) == 1 {
- switch t.PKs[0].IndirectType.Kind() {
+ pk := t.PKs[0]
+ if pk.SQLDefault != "" {
+ return
+ }
+
+ switch pk.IndirectType.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- t.PKs[0].AutoIncrement = true
+ pk.AutoIncrement = true
}
}
}
@@ -359,7 +364,7 @@ func (t *Table) newField(f reflect.StructField, index []int) *Field {
field.DiscoveredSQLType = DiscoverSQLType(field.IndirectType)
field.Append = t.dialect.FieldAppender(field)
field.Scan = FieldScanner(t.dialect, field)
- field.IsZero = FieldZeroChecker(field)
+ field.IsZero = zeroChecker(field.StructField.Type)
if v, ok := tag.Options["alt"]; ok {
t.FieldMap[v] = field