Add unique constraint to hash, email and username
Cette révision appartient à :
Parent
aa08ec9f67
révision
948e7ce8c4
|
@ -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"`
|
||||
|
@ -60,8 +60,8 @@ type Torrent struct {
|
|||
AnidbID string `gorm:"column:anidb_id"`
|
||||
Trackers string `gorm:"column:trackers"`
|
||||
// Indicates the language of the torrent's content (eg. subs, dubs, raws, manga TLs)
|
||||
Language string `gorm:"column:language"`
|
||||
DeletedAt *time.Time
|
||||
Language string `gorm:"column:language"`
|
||||
DeletedAt *time.Time
|
||||
|
||||
Uploader *User `gorm:"AssociationForeignKey:UploaderID;ForeignKey:user_id"`
|
||||
OldUploader string `gorm:"-"` // ???????
|
||||
|
|
|
@ -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