기존 평면 이미지 자산 샤딩 마이그레이션 추가

This commit is contained in:
2026-04-03 14:01:27 +09:00
parent dddb57333c
commit 30ec2e55b0
7 changed files with 122 additions and 0 deletions

View File

@@ -1300,6 +1300,12 @@ async function findImageAssetById(id) {
return mapImageAssetRow(rows[0])
}
async function updateImageAssetSrc({ fromSrc, toSrc }) {
if (!fromSrc || !toSrc || fromSrc === toSrc) return null
await query('UPDATE image_assets SET src = ? WHERE src = ?', [toSrc, fromSrc])
return findImageAssetBySrc(toSrc)
}
async function getReferencedUploadFootprint() {
const [referencedSrcs, assets] = await Promise.all([listReferencedUploadSources(), listImageAssets()])
const assetMap = new Map(assets.map((asset) => [asset.src, asset]))
@@ -3087,6 +3093,7 @@ module.exports = {
findImageAssetByHash,
findImageAssetBySrc,
findImageAssetById,
updateImageAssetSrc,
createImageAsset,
createImageOptimizationJob,
findImageOptimizationJobById,
@@ -3094,6 +3101,7 @@ module.exports = {
listRecentImageOptimizationJobs,
listUnusedImageAssets,
deleteImageAssets,
listImageAssets,
listReferencedUploadSources,
listReferencedUploadUsage,
replaceUploadSourceReferences,