Add project fork to seed file

This commit is contained in:
Lucas Araujo
2021-10-11 14:38:54 -03:00
parent 4b9a8591ab
commit 97437dbdec

View File

@@ -80,9 +80,21 @@ async function main() {
}
existing = await db.project.findMany({where: { title: projects[1].title}})
if(!existing.length) {
await db.project.create({
const result = await db.project.create({
data: projects[1],
})
await db.project.create({
data: {
...projects[1],
title: `${projects[1].title} fork`,
forkedFrom: {
connect: {
id: result.id,
},
},
},
})
}