Make mxc column non-unique for files. Fixes #71

This commit is contained in:
Tulir Asokan
2023-05-27 13:49:57 +03:00
parent 1e9099e989
commit 0fd88fedea
4 changed files with 33 additions and 5 deletions

View File

@@ -39,8 +39,8 @@ func (fq *FileQuery) Get(url string, encrypted bool) *File {
return fq.New().Scan(fq.db.QueryRow(query, url, encrypted))
}
func (fq *FileQuery) GetByMXC(mxc id.ContentURI) *File {
query := fileSelect + " WHERE mxc=$1"
func (fq *FileQuery) GetEmojiByMXC(mxc id.ContentURI) *File {
query := fileSelect + " WHERE mxc=$1 AND emoji_name<>'' LIMIT 1"
return fq.New().Scan(fq.db.QueryRow(query, mxc.String()))
}