File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 "format" : " biome format --write ." ,
1313 "postinstall" : " prisma generate"
1414 },
15+ "prisma" : {
16+ "seed" : " ts-node --compiler-options {\" module\" :\" CommonJS\" } prisma/seed.ts"
17+ },
1518 "dependencies" : {
1619 "@prisma/client" : " ^5.11.0" ,
1720 "@radix-ui/react-dialog" : " ^1.1.1" ,
Original file line number Diff line number Diff line change 1+ import { ElectionStatus , PrismaClient } from "@prisma/client" ;
2+ const prisma = new PrismaClient ( ) ;
3+ const candidates : string [ ] = [ "Candidate_1, Candidate_2, Candidate_3" ] ;
4+
5+ async function main ( ) {
6+ await prisma . election . create ( {
7+ data : {
8+ id : "824a-a25251e23013" ,
9+ name : "Election 4" ,
10+ status : ElectionStatus . FINISHED ,
11+ candidates : {
12+ create : candidates . map ( ( name ) => ( { name } ) ) ,
13+ } ,
14+ } ,
15+ } ) ;
16+ }
17+ main ( ) . then ( async ( ) => {
18+ await prisma . $disconnect ( ) ;
19+ } ) ;
You can’t perform that action at this time.
0 commit comments