diff --git a/.gitignore b/.gitignore index 5c47127..d9389d3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ .vscode *.local /cross +synctv +synctv.* diff --git a/internal/model/user.go b/internal/model/user.go index 7edf998..fff6c3e 100644 --- a/internal/model/user.go +++ b/internal/model/user.go @@ -43,7 +43,7 @@ type User struct { CreatedAt time.Time UpdatedAt time.Time Username string `gorm:"not null;uniqueIndex;type:varchar(32)"` - Email EmptyNullString `gorm:"type:varchar(64);uniqueIndex"` + Email EmptyNullString `gorm:"type:varchar(64);uniqueIndex:,where:email IS NOT NULL"` HashedPassword []byte `gorm:"not null"` BilibiliVendor *BilibiliVendor `gorm:"foreignKey:UserID;constraint:OnUpdate:CASCADE,OnDelete:CASCADE"` Movies []*Movie `gorm:"foreignKey:CreatorID;constraint:OnUpdate:CASCADE,OnDelete:SET NULL"`