Skip to content

Commit a8b09ed

Browse files
committed
fix(db): init record with size
Signed-off-by: ZheNing Hu <adlternative@gmail.com>
1 parent 0d2ca3a commit a8b09ed

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

pkg/model/repository.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ import "gorm.io/gorm"
55
type Repository struct {
66
gorm.Model
77
UserID uint
8-
Name string
9-
Desc string
8+
Name string `gorm:"uniqueIndex;not null;size:24"`
9+
Desc string `gorm:"not null;size:256"`
1010
}

pkg/model/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
type User struct {
88
gorm.Model
99

10-
Name string `gorm:"uniqueIndex;not null" form:"username" binding:"required"`
11-
Email string `gorm:"uniqueIndex;not null" form:"email" binding:"required"`
10+
Name string `gorm:"uniqueIndex;not null;size:24" form:"username"`
11+
Email string `gorm:"uniqueIndex;not null;size:24" form:"email"`
1212

1313
Repositories []Repository
1414
}

0 commit comments

Comments
 (0)