diff --git a/example/basic/main.go b/example/basic/main.go index 38923efe4..72b5dfe57 100644 --- a/example/basic/main.go +++ b/example/basic/main.go @@ -79,7 +79,7 @@ func main() { } type User struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Name string Emails []string } @@ -89,7 +89,7 @@ func (u User) String() string { } type Story struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Title string AuthorID int64 Author *User `bun:"rel:belongs-to,join:author_id=id"` diff --git a/example/create-table-index/main.go b/example/create-table-index/main.go index 6845cbcc1..e4edd166c 100644 --- a/example/create-table-index/main.go +++ b/example/create-table-index/main.go @@ -11,7 +11,7 @@ import ( ) type Book struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Name string CategoryID int64 } diff --git a/example/cursor-pagination/main.go b/example/cursor-pagination/main.go index c2e9bc303..2d50f20d8 100644 --- a/example/cursor-pagination/main.go +++ b/example/cursor-pagination/main.go @@ -58,7 +58,7 @@ func main() { } type Entry struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Text string } diff --git a/example/fixture/main.go b/example/fixture/main.go index b09cb63e9..acccdc205 100644 --- a/example/fixture/main.go +++ b/example/fixture/main.go @@ -25,7 +25,7 @@ type User struct { } type Org struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Name string OwnerID int64 Owner *User `bun:"rel:belongs-to"` diff --git a/example/model-hooks/main.go b/example/model-hooks/main.go index aa2be51a3..8ecede28b 100644 --- a/example/model-hooks/main.go +++ b/example/model-hooks/main.go @@ -49,7 +49,7 @@ func main() { } type User struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Password string CreatedAt time.Time `bun:",nullzero"` UpdatedAt time.Time `bun:",nullzero"` diff --git a/example/multi-tenant/main.go b/example/multi-tenant/main.go index b8ecfa0d3..aeb8a4212 100644 --- a/example/multi-tenant/main.go +++ b/example/multi-tenant/main.go @@ -54,7 +54,7 @@ func selectStories(ctx context.Context, db *bun.DB) ([]*Story, error) { } type Story struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Title string AuthorID int64 } diff --git a/example/opentelemetry/main.go b/example/opentelemetry/main.go index 3c41cc9f8..be62e0afb 100644 --- a/example/opentelemetry/main.go +++ b/example/opentelemetry/main.go @@ -48,7 +48,7 @@ func main() { } type TestModel struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Name string } diff --git a/example/pg-faceted-search/main.go b/example/pg-faceted-search/main.go index 8b58ee926..fea6db73a 100644 --- a/example/pg-faceted-search/main.go +++ b/example/pg-faceted-search/main.go @@ -16,7 +16,7 @@ import ( ) type Book struct { - ID uint64 + ID uint64 `bun:",pk,autoincrement"` Name string Tags []string } diff --git a/example/placeholders/main.go b/example/placeholders/main.go index 822a8d6e5..069817a57 100644 --- a/example/placeholders/main.go +++ b/example/placeholders/main.go @@ -12,7 +12,7 @@ import ( ) type User struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Name string Emails []string } diff --git a/example/rel-belongs-to/main.go b/example/rel-belongs-to/main.go index f3d36ebfd..ff1227739 100644 --- a/example/rel-belongs-to/main.go +++ b/example/rel-belongs-to/main.go @@ -12,13 +12,13 @@ import ( ) type Profile struct { - ID int64 `bun:",pk"` + ID int64 `bun:",pk,autoincrement"` Lang string } // User has one profile. type User struct { - ID int64 `bun:",pk"` + ID int64 `bun:",pk,autoincrement"` Name string ProfileID int64 Profile *Profile `bun:"rel:belongs-to,join=profile_id=id"` diff --git a/example/rel-has-many-polymorphic/main.go b/example/rel-has-many-polymorphic/main.go index 295577117..3478994d3 100644 --- a/example/rel-has-many-polymorphic/main.go +++ b/example/rel-has-many-polymorphic/main.go @@ -20,14 +20,14 @@ type Comment struct { } type Article struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Name string Comments []Comment `bun:"rel:has-many,join:id=trackable_id,join:type=trackable_type,polymorphic"` } type Post struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Name string Comments []Comment `bun:"rel:has-many,join:id=trackable_id,join:type=trackable_type,polymorphic"` diff --git a/example/rel-has-many/main.go b/example/rel-has-many/main.go index 48339f183..ab258f365 100644 --- a/example/rel-has-many/main.go +++ b/example/rel-has-many/main.go @@ -12,7 +12,7 @@ import ( ) type Profile struct { - ID int64 `bun:",pk"` + ID int64 `bun:",pk,autoincrement"` Lang string Active bool UserID int64 @@ -20,7 +20,7 @@ type Profile struct { // User has many profiles. type User struct { - ID int64 `bun:",pk"` + ID int64 `bun:",pk,autoincrement"` Name string Profiles []*Profile `bun:"rel:has-many,join:id=user_id"` } diff --git a/example/rel-has-one/main.go b/example/rel-has-one/main.go index 38aa721ff..7e8d4c6ff 100644 --- a/example/rel-has-one/main.go +++ b/example/rel-has-one/main.go @@ -13,13 +13,13 @@ import ( // Profile belongs to User. type Profile struct { - ID int64 `bun:",pk"` + ID int64 `bun:",pk,autoincrement"` Lang string UserID int64 } type User struct { - ID int64 `bun:",pk"` + ID int64 `bun:",pk,autoincrement"` Name string Profile *Profile `bun:"rel:has-one,join:id=user_id"` } diff --git a/example/rel-many-to-many-self/main.go b/example/rel-many-to-many-self/main.go index 3f0c8a4c5..e9c057151 100644 --- a/example/rel-many-to-many-self/main.go +++ b/example/rel-many-to-many-self/main.go @@ -12,7 +12,7 @@ import ( ) type Item struct { - ID int64 `bun:",pk"` + ID int64 `bun:",pk,autoincrement"` Children []Item `bun:"m2m:item_to_items,join:Item=Child"` } diff --git a/example/rel-many-to-many/main.go b/example/rel-many-to-many/main.go index 8c1101e9d..90cea02bc 100644 --- a/example/rel-many-to-many/main.go +++ b/example/rel-many-to-many/main.go @@ -12,13 +12,13 @@ import ( ) type Order struct { - ID int64 `bun:",pk"` + ID int64 `bun:",pk,autoincrement"` // Order and Item in join:Order=Item are fields in OrderToItem model Items []Item `bun:"m2m:order_to_items,join:Order=Item"` } type Item struct { - ID int64 `bun:",pk"` + ID int64 `bun:",pk,autoincrement"` // Order and Item in join:Order=Item are fields in OrderToItem model Orders []Order `bun:"m2m:order_to_items,join:Item=Order"` } diff --git a/example/tx-composition/main.go b/example/tx-composition/main.go index b9048180e..5edf3c7dc 100644 --- a/example/tx-composition/main.go +++ b/example/tx-composition/main.go @@ -57,7 +57,7 @@ func insertUserAndProfile(ctx context.Context, db bun.IDB) error { } type User struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` Name string } @@ -67,7 +67,7 @@ func InsertUser(ctx context.Context, db bun.IDB, user *User) error { } type Profile struct { - ID int64 + ID int64 `bun:",pk,autoincrement"` UserID int64 Email string }