@@ -67,31 +67,6 @@ export default eventHandler((event) => {
6767})
6868`
6969
70- const prismaUtils = `import { execSync } from 'node:child_process'
71-
72- /**
73- * Helper to reset the database via a programmatic prisma invocation. Helpful to add to \`beforeEach\` or \`beforeAll\` of your testing setup.
74- *
75- * WARNING: Never run this in production.
76- *
77- * Taken from https://github.com/prisma/prisma/issues/13549#issuecomment-1144883246
78- *
79- * @param databaseUrl Connection URL to database. Inferred from \`process.env.DATABASE_URL\` if not provided
80- */
81- export function resetDatabase(databaseUrl?: string) {
82- const url = databaseUrl || process.env.DATABASE_URL
83- if (!url) {
84- throw new Error('Cannot reset database - connection string could not be inferred.')
85- }
86-
87- if (process.env.NODE_ENV === 'production') {
88- throw new Error('This utility should not be called in production. It is meant for testing and development')
89- }
90-
91- execSync(\`cd \${process.cwd()} && DATABASE_URL=\${url} npx prisma db push --force-reset\`, { stdio: 'inherit' })
92- }
93- `
94-
9570const pglite = `/**
9671 * Script that starts a postgres database using pg-gateway (https://github.com/supabase-community/pg-gateway) and pglite (https://github.com/electric-sql/pglite).
9772 *
@@ -197,17 +172,17 @@ const prisma: ModuleConfig = {
197172 dependencies : [
198173 {
199174 name : 'prisma' ,
200- version : '^5.18 .0' ,
175+ version : '^5.22 .0' ,
201176 isDev : true
202177 } ,
203178 {
204179 name : '@prisma/client' ,
205- version : '^5.18 .0' ,
180+ version : '^5.22 .0' ,
206181 isDev : false
207182 } ,
208183 {
209184 name : '@electric-sql/pglite' ,
210- version : '^ 0.2.9 ' ,
185+ version : '0.2.13 ' ,
211186 isDev : true ,
212187 } ,
213188 {
@@ -217,36 +192,41 @@ const prisma: ModuleConfig = {
217192 } ,
218193 {
219194 name : 'vite-node' ,
220- version : '^2.1.1 ' ,
195+ version : '^2.1.5 ' ,
221196 isDev : true ,
222197 }
223198 ] ,
224199 nuxtConfig : { } ,
225- files : [ {
226- path : '.env' ,
227- content : prismaEnvFile
228- } , {
229- path : 'prisma/schema/schema.prisma' ,
230- content : prismaRootSchema
231- } , {
232- path : 'prisma/schema/example.prisma' ,
233- content : prismaExampleSchema
234- } , {
235- path : 'server/api/examples.get.ts' ,
236- content : prismaExampleEndpoint
237- } , {
238- path : 'server/middleware/0.prisma.ts' ,
239- content : prismaServerMiddleware
240- } , {
241- path : 'prisma/utils.ts' ,
242- content : prismaUtils
243- } , {
244- path : 'components/Welcome/PrismaDemo.vue' ,
245- content : prismaDemoComponent ,
246- } , {
247- path : 'prisma/pglite.ts' ,
248- content : pglite ,
249- } ] ,
200+ files : [
201+ {
202+ path : '.env' ,
203+ content : prismaEnvFile
204+ } ,
205+ {
206+ path : 'prisma/schema/schema.prisma' ,
207+ content : prismaRootSchema
208+ } ,
209+ {
210+ path : 'prisma/schema/example.prisma' ,
211+ content : prismaExampleSchema
212+ } ,
213+ {
214+ path : 'server/api/examples.get.ts' ,
215+ content : prismaExampleEndpoint
216+ } ,
217+ {
218+ path : 'server/middleware/0.prisma.ts' ,
219+ content : prismaServerMiddleware
220+ } ,
221+ {
222+ path : 'components/Welcome/PrismaDemo.vue' ,
223+ content : prismaDemoComponent ,
224+ } ,
225+ {
226+ path : 'prisma/pglite.ts' ,
227+ content : pglite ,
228+ }
229+ ] ,
250230 tasksPostInstall : [
251231 '- [ ] Prisma: Edit your `prisma/prisma.schema` to your liking' ,
252232 `- [ ] Prisma: Start your local postgres database using \`${ getUserPkgManager ( ) } run db\`` ,
0 commit comments