37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import { PrismaClient } from '@prisma/client';
|
|||
|
|
import { PLUGIN_CATALOG_SEED } from '../src/plugins/plugin-catalog.seed';
|
||
|
|
|
||
|
|
const prisma = new PrismaClient();
|
||
|
|
|
||
|
|
async function main() {
|
||
|
|
console.log('Updating plugin store catalog descriptions in database...');
|
||
|
|
let updatedCount = 0;
|
||
|
|
|
||
|
|
for (const seed of PLUGIN_CATALOG_SEED) {
|
||
|
|
const res = await prisma.pluginCatalogItem.updateMany({
|
||
|
|
where: { settingKey: seed.settingKey },
|
||
|
|
data: {
|
||
|
|
description: seed.description,
|
||
|
|
titleFa: seed.titleFa,
|
||
|
|
},
|
||
|
|
});
|
||
|
|
if (res.count > 0) {
|
||
|
|
console.log(`✓ Updated [${seed.settingKey}] - ${seed.titleFa}`);
|
||
|
|
updatedCount += res.count;
|
||
|
|
} else {
|
||
|
|
console.log(`- Item [${seed.settingKey}] not yet in DB (will be seeded on next bootstrap)`);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
console.log(`\nSuccessfully updated ${updatedCount} plugin store items!`);
|
||
|
|
}
|
||
|
|
|
||
|
|
main()
|
||
|
|
.catch((e) => {
|
||
|
|
console.error('Error updating descriptions:', e);
|
||
|
|
process.exit(1);
|
||
|
|
})
|
||
|
|
.finally(async () => {
|
||
|
|
await prisma.$disconnect();
|
||
|
|
});
|