Kenneth Faria
02/26/2021, 8:16 PMKenneth Faria
02/26/2021, 8:36 PMMartïn
02/27/2021, 3:22 PMseed-user.js
, seed-post.js
seeds user and post. I run seed-user.js before post...I have over 300 models currently.Ryan
03/01/2021, 6:32 AMKenneth Faria
03/01/2021, 2:38 PMawait prisma.post.create({
data: {
title: 'Types of relations',
tags: { create: [{ name: 'dev' }, { name: 'prisma' }] },
},
})
I found it a little cumbersome to nest 2-3 levels of create (and I think also ran into problems), and currently am ingesting related data in bulk using id's. Here's an example:
expor const container = {
pipelineId: 1,
dataElementMatchList: [
{
dataElementId: 1,
matches: 'match pattern',
},
]
}
Where there is a pipeline table, and a dataElement table and a 1-1 relationship between container and pipeline and an m-n relationship between dataElements and containers. Is there anyway when seeding to seed this data and their relationships without specifying IDs? I am doing what @Martïn suggests, but want to move away from specifying IDs so scalability and maintainability. I am also realizing that I could probably just ingest the parent seed data and run a query right? Just wanted to see what everyone does on a larger scale to seed their DBs!Ryan
03/02/2021, 3:19 PMKenneth Faria
03/02/2021, 10:55 PM