Add authorNames columns and indices to LibraryItem model

This commit is contained in:
mikiher 2025-03-07 07:14:56 +02:00
parent e0e1d2d380
commit edccb7241b

View file

@ -77,6 +77,10 @@ class LibraryItem extends Model {
this.title // Only used for sorting this.title // Only used for sorting
/** @type {string} */ /** @type {string} */
this.titleIgnorePrefix // Only used for sorting this.titleIgnorePrefix // Only used for sorting
/** @type {string} */
this.authorNamesFirstLast // Only used for sorting
/** @type {string} */
this.authorNamesLastFirst // Only used for sorting
} }
/** /**
@ -683,7 +687,9 @@ class LibraryItem extends Model {
libraryFiles: DataTypes.JSON, libraryFiles: DataTypes.JSON,
extraData: DataTypes.JSON, extraData: DataTypes.JSON,
title: DataTypes.STRING, title: DataTypes.STRING,
titleIgnorePrefix: DataTypes.STRING titleIgnorePrefix: DataTypes.STRING,
authorNamesFirstLast: DataTypes.STRING,
authorNamesLastFirst: DataTypes.STRING
}, },
{ {
sequelize, sequelize,
@ -710,6 +716,12 @@ class LibraryItem extends Model {
{ {
fields: ['libraryId', 'mediaType', { name: 'titleIgnorePrefix', collate: 'NOCASE' }] fields: ['libraryId', 'mediaType', { name: 'titleIgnorePrefix', collate: 'NOCASE' }]
}, },
{
fields: ['libraryId', 'mediaType', { name: 'authorNamesFirstLast', collate: 'NOCASE' }]
},
{
fields: ['libraryId', 'mediaType', { name: 'authorNamesLastFirst', collate: 'NOCASE' }]
},
{ {
fields: ['libraryId', 'mediaId', 'mediaType'] fields: ['libraryId', 'mediaId', 'mediaType']
}, },