diff --git a/desci-server/src/scripts/fixPublish.ts b/desci-server/src/scripts/fixPublish.ts index a1374bb9..39aa99d9 100644 --- a/desci-server/src/scripts/fixPublish.ts +++ b/desci-server/src/scripts/fixPublish.ts @@ -3,7 +3,7 @@ import { logger as parentLogger } from '../logger.js'; import { redisClient } from '../redisClient.js'; import { publishSequencer, PublishServices } from '../services/PublishServices.js'; import { getIndexedResearchObjects } from '../theGraph.js'; -import { hexToCid } from '../utils.js'; +import { ensureUuidEndsWithDot, hexToCid } from '../utils.js'; import { invalidateByUuid } from './invalidate-redis-cache.js'; @@ -96,7 +96,12 @@ async function fixByNodeUuids({ cLogger.info(`[fixByNodeUuids] Fixing version: ${nodeVersIdx + 1}, with commitId: ${commitId}`); if (createIjPublishStatusEntry) { - // Add IJ publishStatus entry for the commitId + // Add IJ publishStatus entry for the commitId + remove existing PDRs + const node = await prisma.node.findUnique({ + where: { uuid: ensureUuidEndsWithDot(nodeUuid) }, + select: { id: true }, + }); + await prisma.publicDataReference.deleteMany({ where: { nodeId: node.id } }); await addIjPublishStatusEntry({ commitId, version: nodeVersIdx + 1, nodeUuid, manifestCid }); }