Skip to content

Commit

Permalink
Fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
rocktimsaikia committed Dec 25, 2024
1 parent 5cb3244 commit 63249a0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions server/scripts/populate-altname.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ const filePath = "../data/anime-with-no-alt-name.csv";
fs.createReadStream(filePath)
.pipe(parse(options))
.on("data", async (row) => {
const data = await prisma.anime.findUnique({
const updatedRecord = await prisma.anime.update({
where: {
name: row.name,
id: row.id,
},
select: {
id: true,
name: true,
data: {
name: row.name,
altName: row.altName,
malId: row.malId,
episodeCount: row.episodeCount,
},
});
if (data) {
console.log(data);
if (updatedRecord) {
console.log(`Updated ${updatedRecord.id}`);
}
})
.on("error", (err) => {
Expand Down

0 comments on commit 63249a0

Please sign in to comment.