- 迁移57个老素材到新逻辑(本地zip + S3预览图) - 优化文件命名:SPU_作者_店铺_类型.zip - PSD文件单独存储,不打包进all.zip - 修复下载接口,优先使用本地zip文件 - 修复预览图重复问题 - 添加迁移脚本和验证脚本 - 更新文档和迁移计划 迁移统计: - 总素材数:77个 - 成功迁移:57个 - 新逻辑上传:18个 - 空记录:2个
205 lines
6.2 KiB
TypeScript
205 lines
6.2 KiB
TypeScript
/**
|
|
* 恢复被误删的老资产记录
|
|
*
|
|
* 从备份数据库中恢复 XG0176 素材的老资产记录
|
|
*/
|
|
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
// XG0176 素材的老资产记录(从备份中提取)
|
|
const OLD_ASSETS = [
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'main',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/main-1768468700756-ijjnvb0.webp',
|
|
fileName: '买家秀1.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 0,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468700815-q5w6p65.webp',
|
|
fileName: 'XG013202.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 0,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468700838-qaepw84.webp',
|
|
fileName: 'XG013207.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 1,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468700851-zuvkpkc.webp',
|
|
fileName: 'XG013212.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 2,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468700930-mak6wa7.webp',
|
|
fileName: 'XG013218.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 3,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701025-d1kzumc.webp',
|
|
fileName: 'XG014805.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 4,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701082-hdneh4f.webp',
|
|
fileName: 'XG014808.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 5,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701145-lnajgol.webp',
|
|
fileName: 'XG014811.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 6,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701155-rxdclvw.webp',
|
|
fileName: 'XG017601.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 7,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701205-k8eratf.webp',
|
|
fileName: 'XG017602.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 8,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701275-hhqf538.webp',
|
|
fileName: 'xg017603.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 9,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701333-8tkk5vb.webp',
|
|
fileName: 'xg017604.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 10,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701375-6pi0ak0.webp',
|
|
fileName: 'XG017610.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 11,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701392-456m2q8.webp',
|
|
fileName: 'XG017611.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 12,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701448-8itfhtm.webp',
|
|
fileName: 'XG017612.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 13,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701528-5x525v6.webp',
|
|
fileName: 'XG017613.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 14,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701563-2yqb0ia.webp',
|
|
fileName: 'XG017614.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 15,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701616-0d467x5.webp',
|
|
fileName: 'XG017615.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 16,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701627-t80jbug.webp',
|
|
fileName: 'XG017907.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 17,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701709-y1yfv5e.webp',
|
|
fileName: 'XG017908.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 18,
|
|
},
|
|
{
|
|
materialId: 'f8148b30-d83f-4e6a-800e-fa047efd9b16',
|
|
assetType: 'sku',
|
|
fileUrl: 'https://s3.yydd.ai/gongxiangpan/由壹点AI/product-package/sku-1768468701730-twc1ovy.webp',
|
|
fileName: 'XG017909.jpg',
|
|
fileSize: BigInt(0),
|
|
sortOrder: 19,
|
|
},
|
|
];
|
|
|
|
async function main() {
|
|
console.log('='.repeat(60));
|
|
console.log('恢复被误删的老资产记录');
|
|
console.log('='.repeat(60));
|
|
console.log(`将恢复 ${OLD_ASSETS.length} 条资产记录`);
|
|
console.log('');
|
|
|
|
try {
|
|
await prisma.materialAsset.createMany({
|
|
data: OLD_ASSETS,
|
|
});
|
|
|
|
console.log('✅ 恢复完成');
|
|
} catch (error) {
|
|
console.error('恢复失败:', error);
|
|
process.exit(1);
|
|
} finally {
|
|
await prisma.$disconnect();
|
|
}
|
|
}
|
|
|
|
main();
|