mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-04-20 01:17:45 +02: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) => {
|
module.exports.migrationPatch2 = async (ctx) => {
|
||||||
const queryInterface = ctx.sequelize.getQueryInterface()
|
const queryInterface = ctx.sequelize.getQueryInterface()
|
||||||
const libraryItemsIndexes = await queryInterface.showIndex('libraryItems')
|
|
||||||
const feedTableDescription = await queryInterface.describeTable('feeds')
|
const feedTableDescription = await queryInterface.describeTable('feeds')
|
||||||
const authorsTableDescription = await queryInterface.describeTable('authors')
|
const authorsTableDescription = await queryInterface.describeTable('authors')
|
||||||
const bookAuthorsTableDescription = await queryInterface.describeTable('bookAuthors')
|
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`)
|
Logger.info(`[dbMigration] Migration patch 2.3.3+ - columns already on model`)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -1633,20 +1632,7 @@ module.exports.migrationPatch2 = async (ctx) => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await queryInterface.sequelize.transaction(t => {
|
await queryInterface.sequelize.transaction(t => {
|
||||||
const queries = [
|
const queries = []
|
||||||
queryInterface.addIndex('libraryItems', {
|
|
||||||
fields: ['mediaId'],
|
|
||||||
transaction: t
|
|
||||||
}),
|
|
||||||
queryInterface.addIndex('libraryItems', {
|
|
||||||
fields: ['createdAt'],
|
|
||||||
transaction: t
|
|
||||||
}),
|
|
||||||
queryInterface.addIndex('mediaProgresses', {
|
|
||||||
fields: ['updatedAt'],
|
|
||||||
transaction: t
|
|
||||||
})
|
|
||||||
]
|
|
||||||
if (!bookAuthorsTableDescription?.createdAt) {
|
if (!bookAuthorsTableDescription?.createdAt) {
|
||||||
queries.push(...[
|
queries.push(...[
|
||||||
queryInterface.addColumn('bookAuthors', 'createdAt', {
|
queryInterface.addColumn('bookAuthors', 'createdAt', {
|
||||||
|
Loading…
Reference in New Issue
Block a user