Add unique constraint to hash, email and username
Cette révision appartient à :
Parent
aa08ec9f67
révision
948e7ce8c4
2 fichiers modifiés avec 5 ajouts et 5 suppressions
|
@ -45,7 +45,7 @@ type Feed struct {
|
|||
type Torrent struct {
|
||||
ID uint `gorm:"column:torrent_id;primary_key"`
|
||||
Name string `gorm:"column:torrent_name"`
|
||||
Hash string `gorm:"column:torrent_hash"`
|
||||
Hash string `gorm:"column:torrent_hash;unique"`
|
||||
Category int `gorm:"column:category"`
|
||||
SubCategory int `gorm:"column:sub_category"`
|
||||
Status int `gorm:"column:status"`
|
||||
|
|
|
@ -24,9 +24,9 @@ const (
|
|||
// User model
|
||||
type User struct {
|
||||
ID uint `gorm:"column:user_id;primary_key"`
|
||||
Username string `gorm:"column:username"`
|
||||
Username string `gorm:"column:username;unique"`
|
||||
Password string `gorm:"column:password"`
|
||||
Email string `gorm:"column:email"`
|
||||
Email string `gorm:"column:email;unique"`
|
||||
Status int `gorm:"column:status"`
|
||||
CreatedAt time.Time `gorm:"column:created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at"`
|
||||
|
|
Référencer dans un nouveau ticket