mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-02 22:19:40 +00:00
Fix library consolidation filter and implement podcast support
This commit is contained in:
parent
b3cdd880e1
commit
23034e6672
12 changed files with 153 additions and 14 deletions
45
server/migrations/v2.32.2-add-is-not-consolidated-column.js
Normal file
45
server/migrations/v2.32.2-add-is-not-consolidated-column.js
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/**
|
||||
* @typedef MigrationContext
|
||||
* @property {import('sequelize').QueryInterface} queryInterface - a suquelize QueryInterface object.
|
||||
* @property {import('../Logger')} logger - a Logger object.
|
||||
*
|
||||
* @typedef MigrationOptions
|
||||
* @property {MigrationContext} context - an object containing the migration context.
|
||||
*/
|
||||
|
||||
const migrationVersion = '2.32.2'
|
||||
const migrationName = `${migrationVersion}-add-is-not-consolidated-column`
|
||||
const loggerPrefix = `[${migrationVersion} migration]`
|
||||
|
||||
/**
|
||||
* Adds isNotConsolidated column to libraryItems table.
|
||||
*
|
||||
* @param {MigrationOptions} options
|
||||
*/
|
||||
async function up({ context: { queryInterface, logger } }) {
|
||||
logger.info(`${loggerPrefix} UPGRADE BEGIN: ${migrationName}`)
|
||||
|
||||
const tableDescription = await queryInterface.describeTable('libraryItems')
|
||||
if (!tableDescription['isNotConsolidated']) {
|
||||
await queryInterface.addColumn('libraryItems', 'isNotConsolidated', {
|
||||
type: queryInterface.sequelize.Sequelize.BOOLEAN,
|
||||
defaultValue: false
|
||||
})
|
||||
logger.info(`${loggerPrefix} added column "isNotConsolidated" to table "libraryItems"`)
|
||||
} else {
|
||||
logger.info(`${loggerPrefix} column "isNotConsolidated" already exists in table "libraryItems"`)
|
||||
}
|
||||
|
||||
logger.info(`${loggerPrefix} UPGRADE END: ${migrationName}`)
|
||||
}
|
||||
|
||||
async function down({ context: { queryInterface, logger } }) {
|
||||
logger.info(`${loggerPrefix} DOWNGRADE BEGIN: ${migrationName}`)
|
||||
|
||||
await queryInterface.removeColumn('libraryItems', 'isNotConsolidated')
|
||||
logger.info(`${loggerPrefix} removed column "isNotConsolidated" from table "libraryItems"`)
|
||||
|
||||
logger.info(`${loggerPrefix} DOWNGRADE END: ${migrationName}`)
|
||||
}
|
||||
|
||||
module.exports = { up, down }
|
||||
Loading…
Add table
Add a link
Reference in a new issue