mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-02-27 15:41:15 +01:00
Remove index creation from migration file
This commit is contained in:
parent
05b1b2be36
commit
adccccbd7a
@ -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', {
|
||||
|
Loading…
Reference in New Issue
Block a user