Skip to content

Commit d6d653e

Browse files
chore: add comment about closing PrismaClient and Connector (#353)
1 parent dc7e0d0 commit d6d653e

File tree

6 files changed

+18
-0
lines changed

6 files changed

+18
-0
lines changed

examples/prisma/mysql/connect.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ async function connect({instanceConnectionName, user, database}) {
2929
const datasourceUrl = `mysql://${user}@localhost/${database}?socket=${path}`;
3030
const prisma = new PrismaClient({datasourceUrl});
3131

32+
// Return PrismaClient and close() function. Call close() when you are
33+
// done using the PrismaClient to ensure client gracefully disconnects and
34+
// local Unix socket file created by the Connector is deleted.
3235
return {
3336
prisma,
3437
async close() {

examples/prisma/mysql/connect.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export async function connect({instanceConnectionName, user, database}) {
2929
const datasourceUrl = `mysql://${user}@localhost/${database}?socket=${path}`;
3030
const prisma = new PrismaClient({datasourceUrl});
3131

32+
// Return PrismaClient and close() function. Call close() when you are
33+
// done using the PrismaClient to ensure client gracefully disconnects and
34+
// local Unix socket file created by the Connector is deleted.
3235
return {
3336
prisma,
3437
async close() {

examples/prisma/mysql/connect.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ export async function connect({instanceConnectionName, user, database}) {
3333
const datasourceUrl = `mysql://${user}@localhost/${database}?socket=${path}`;
3434
const prisma = new PrismaClient({datasourceUrl});
3535

36+
// Return PrismaClient and close() function. Call close() when you are
37+
// done using the PrismaClient to ensure client gracefully disconnects and
38+
// local Unix socket file created by the Connector is deleted.
3639
return {
3740
prisma,
3841
async close() {

examples/prisma/postgresql/connect.cjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ async function connect({instanceConnectionName, user, database}) {
3232
const datasourceUrl = `postgresql://${user}@localhost/${database}?host=${process.cwd()}`;
3333
const prisma = new PrismaClient({datasourceUrl});
3434

35+
// Return PrismaClient and close() function. Call close() when you are
36+
// done using the PrismaClient to ensure client gracefully disconnects and
37+
// local Unix socket file created by the Connector is deleted.
3538
return {
3639
prisma,
3740
async close() {

examples/prisma/postgresql/connect.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ export async function connect({instanceConnectionName, user, database}) {
3232
const datasourceUrl = `postgresql://${user}@localhost/${database}?host=${process.cwd()}`;
3333
const prisma = new PrismaClient({datasourceUrl});
3434

35+
// Return PrismaClient and close() function. Call close() when you are
36+
// done using the PrismaClient to ensure client gracefully disconnects and
37+
// local Unix socket file created by the Connector is deleted.
3538
return {
3639
prisma,
3740
async close() {

examples/prisma/postgresql/connect.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ export async function connect({instanceConnectionName, user, database}) {
3636
const datasourceUrl = `postgresql://${user}@localhost/${database}?host=${process.cwd()}`;
3737
const prisma = new PrismaClient({datasourceUrl});
3838

39+
// Return PrismaClient and close() function. Call close() when you are
40+
// done using the PrismaClient to ensure client gracefully disconnects and
41+
// local Unix socket file created by the Connector is deleted.
3942
return {
4043
prisma,
4144
async close() {

0 commit comments

Comments
 (0)