From 7a4e353718e715db8879cc7d4ba75f6c6b49d058 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 4 Feb 2025 08:09:32 +0100 Subject: [PATCH] Add web video redundancy migration --- server/core/initializers/constants.ts | 2 +- .../migrations/0870-remove-web-video-redundancy.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/server/core/initializers/constants.ts b/server/core/initializers/constants.ts index 7436a7412..87dce5e24 100644 --- a/server/core/initializers/constants.ts +++ b/server/core/initializers/constants.ts @@ -46,7 +46,7 @@ import { CONFIG, registerConfigChangedHandler } from './config.js' // --------------------------------------------------------------------------- -export const LAST_MIGRATION_VERSION = 865 +export const LAST_MIGRATION_VERSION = 870 // --------------------------------------------------------------------------- diff --git a/server/core/initializers/migrations/0870-remove-web-video-redundancy.ts b/server/core/initializers/migrations/0870-remove-web-video-redundancy.ts index 8bf405d27..9d2b0fc97 100644 --- a/server/core/initializers/migrations/0870-remove-web-video-redundancy.ts +++ b/server/core/initializers/migrations/0870-remove-web-video-redundancy.ts @@ -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 { 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 }) } {