Skip to content

Commit

Permalink
fix prisma seed create only one instance of prisma client
Browse files Browse the repository at this point in the history
  • Loading branch information
lhapaipai committed Nov 13, 2024
1 parent 8bfb445 commit 6c85fcb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions prisma/seed.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Interval } from '#app/modules/stripe/plans'
import { PrismaClient } from '@prisma/client'
import { prisma } from '#app/utils/db.server'
import { stripe } from '#app/modules/stripe/stripe.server'
import { PRICING_PLANS } from '#app/modules/stripe/plans'

const client = new PrismaClient()
const prisma = new PrismaClient()
prisma.$connect()

async function seed() {
/**
Expand Down Expand Up @@ -157,10 +157,11 @@ async function seed() {
}

seed()
.catch((err: unknown) => {
.catch(async (err) => {
console.error(err)
await prisma.$disconnect()
process.exit(1)
})
.finally(async () => {
await client.$disconnect()
.then(async () => {
await prisma.$disconnect()
})

0 comments on commit 6c85fcb

Please sign in to comment.