Add web video redundancy migration

This commit is contained in:
Chocobozzz 2025-02-04 08:09:32 +01:00
parent c791e6d523
commit 7a4e353718
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 3 additions and 7 deletions

View File

@ -46,7 +46,7 @@ import { CONFIG, registerConfigChangedHandler } from './config.js'
// ---------------------------------------------------------------------------
export const LAST_MIGRATION_VERSION = 865
export const LAST_MIGRATION_VERSION = 870
// ---------------------------------------------------------------------------

View File

@ -1,5 +1,4 @@
import { logger } from '@server/helpers/logger.js'
import { getServerActor } from '@server/models/application/application.js'
import { VideoFileModel } from '@server/models/video/video-file.js'
import { remove } from 'fs-extra'
import { join } from 'path'
@ -14,13 +13,10 @@ async function up (utils: {
}): Promise<void> {
const { transaction } = utils
const actor = await getServerActor()
{
const query = 'SELECT "videoFileId" FROM "videoRedundancy" WHERE "actor" = :actorId AND "videoFileId" IS NOT NULL'
const query = 'SELECT "videoFileId" FROM "videoRedundancy" WHERE "strategy" IS NOT NULL AND "videoFileId" IS NOT NULL'
const rows = await utils.sequelize.query<{ videoFileId: number }>(query, {
bind: { actorId: actor.id },
transaction,
type: QueryTypes.SELECT as QueryTypes.SELECT
})
@ -44,7 +40,7 @@ async function up (utils: {
}
{
await utils.sequelize.query('DROP INDEX IF EXISTS video_redundancy_video_file_id')
await utils.sequelize.query('DROP INDEX IF EXISTS video_redundancy_video_file_id', { transaction })
}
{