Remove index creation from migration file

This commit is contained in:
advplyr 2023-09-05 15:36:19 -05:00
parent 05b1b2be36
commit adccccbd7a

View File

@ -1620,12 +1620,11 @@ async function migrationPatch2BookSeries(ctx, offset = 0) {
*/
module.exports.migrationPatch2 = async (ctx) => {
const queryInterface = ctx.sequelize.getQueryInterface()
const libraryItemsIndexes = await queryInterface.showIndex('libraryItems')
const feedTableDescription = await queryInterface.describeTable('feeds')
const authorsTableDescription = await queryInterface.describeTable('authors')
const bookAuthorsTableDescription = await queryInterface.describeTable('bookAuthors')
if (feedTableDescription?.coverPath && authorsTableDescription?.lastFirst && bookAuthorsTableDescription?.createdAt && libraryItemsIndexes.some(lii => lii.name === 'library_items_created_at')) {
if (feedTableDescription?.coverPath && authorsTableDescription?.lastFirst && bookAuthorsTableDescription?.createdAt) {
Logger.info(`[dbMigration] Migration patch 2.3.3+ - columns already on model`)
return false
}
@ -1633,20 +1632,7 @@ module.exports.migrationPatch2 = async (ctx) => {
try {
await queryInterface.sequelize.transaction(t => {
const queries = [
queryInterface.addIndex('libraryItems', {
fields: ['mediaId'],
transaction: t
}),
queryInterface.addIndex('libraryItems', {
fields: ['createdAt'],
transaction: t
}),
queryInterface.addIndex('mediaProgresses', {
fields: ['updatedAt'],
transaction: t
})
]
const queries = []
if (!bookAuthorsTableDescription?.createdAt) {
queries.push(...[
queryInterface.addColumn('bookAuthors', 'createdAt', {