fix: unique entity

This commit is contained in:
ericprd
2025-03-01 21:27:28 +08:00
parent bdf6dd131e
commit eb1584f8c4
6 changed files with 13 additions and 10 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import "time"
type Category struct {
ID string `gorm:"primaryKey;not null" json:"id"`
Code string `gorm:"not null" json:"code"`
Code string `gorm:"not null;unique" json:"code"`
Name string `gorm:"not null" json:"name"`
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`