From 76d641db9c412dc5847c836fcd30433c92ae59e5 Mon Sep 17 00:00:00 2001 From: Nicholas Wallace Date: Sun, 31 May 2026 08:43:40 -0700 Subject: [PATCH] Remove Author model references from migration script --- server/migrations/v2.35.2-add-author-search-name.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/server/migrations/v2.35.2-add-author-search-name.js b/server/migrations/v2.35.2-add-author-search-name.js index 7452d0554..2506ec1e9 100644 --- a/server/migrations/v2.35.2-add-author-search-name.js +++ b/server/migrations/v2.35.2-add-author-search-name.js @@ -9,9 +9,7 @@ const { Sequelize } = require('sequelize') * @property {MigrationContext} context - an object containing the migration context. */ -const Author = require('../models/Author') - -const migrationVersion = '2.34.0' +const migrationVersion = '2.35.2' const migrationName = `${migrationVersion}-add-author-search-name` const loggerPrefix = `[${migrationVersion} migration]` const AUTHORS_TABLE = 'authors' @@ -87,7 +85,7 @@ async function removeIndexIfPresent(queryInterface, logger, tableName, indexName await queryInterface.removeIndex(tableName, indexName) } -async function backfillAuthorSearchName(queryInterface, logger, transaction, Author, offset = 0) { +async function backfillAuthorSearchName(queryInterface, logger, transaction, offset = 0) { while (true) { const authors = await queryInterface.sequelize.query(`SELECT id, name FROM ${AUTHORS_TABLE} ORDER BY id ASC LIMIT :limit OFFSET :offset`, { replacements: { limit: 500, offset }, @@ -254,7 +252,6 @@ async function refreshLibraryItemAuthorNames(queryInterface, transaction) { async function up({ context: { queryInterface, logger } }) { logger.info(`${loggerPrefix} UPGRADE BEGIN: ${migrationName}`) - const Author = require('../models/Author') const tableDescription = await queryInterface.describeTable(AUTHORS_TABLE) await queryInterface.sequelize.transaction(async (transaction) => { @@ -288,7 +285,7 @@ async function up({ context: { queryInterface, logger } }) { ) } - await backfillAuthorSearchName(queryInterface, logger, transaction, Author, 0) + await backfillAuthorSearchName(queryInterface, logger, transaction, 0) await mergeDuplicateAuthors(queryInterface, logger, transaction) await cleanupDuplicateBookAuthors(queryInterface, transaction) await refreshLibraryItemAuthorNames(queryInterface, transaction)