Skip to content

Commit

Permalink
fix: fix missing autoincrement warning
Browse files Browse the repository at this point in the history
  • Loading branch information
vmihailenco committed Feb 22, 2022
1 parent 49fd3ec commit 3bc9c72
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions schema/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ func (t *Table) initFields() {
switch pk.IndirectType.Kind() {
case reflect.Int, reflect.Int32, reflect.Int64,
reflect.Uint, reflect.Uint32, reflect.Uint64:
internal.Warn.Printf("missing `bun:\",autoincrement\" on %s.%s field`",
t.TypeName, pk.GoName)
if !pk.Tag.HasOption("autoincrement") {
internal.Warn.Printf("missing `bun:\",autoincrement\" on %s.%s field`",
t.TypeName, pk.GoName)
}
pk.AutoIncrement = true
}
}
Expand Down

0 comments on commit 3bc9c72

Please sign in to comment.