Added tag reassociation and dedupe migration.

This commit is contained in:
DebaucheryLibrarian
2026-02-22 06:24:26 +01:00
parent e3b922da6c
commit b95e2fadf7
6 changed files with 156 additions and 7 deletions

View File

@@ -368,9 +368,7 @@ async function searchEntities(query, type, limit) {
return curateEntities(entities);
}
async function flushEntities(networkSlugs = [], channelSlugs = []) {
const entitySlugs = networkSlugs.concat(channelSlugs).join(', ');
async function fetchEntityReleaseIds(networkSlugs = [], channelSlugs = []) {
const entityQuery = knex
.withRecursive('selected_entities', knex.raw(`
SELECT entities.*
@@ -443,6 +441,17 @@ async function flushEntities(networkSlugs = [], channelSlugs = []) {
})
.pluck('series.id');
return {
sceneIds,
movieIds,
serieIds,
};
}
async function flushEntities(networkSlugs = [], channelSlugs = []) {
const { sceneIds, movieIds, serieIds } = await fetchEntityReleaseIds(networkSlugs, channelSlugs);
const entitySlugs = networkSlugs.concat(channelSlugs).join(', ');
if (sceneIds.length === 0 && movieIds.length === 0 && serieIds.length === 0) {
logger.info(`No scenes, movies or series found to remove for ${entitySlugs}`);
return;
@@ -479,6 +488,7 @@ module.exports = {
fetchIncludedEntities,
fetchReleaseEntities,
fetchEntitiesBySlug,
fetchEntityReleaseIds,
fetchEntity,
fetchEntities,
getRecursiveParent,