From b3ce004affb9474e53e845e8507f676e3a771de0 Mon Sep 17 00:00:00 2001 From: Julius Marminge <julius0216@outlook.com> Date: Sun, 28 Aug 2022 12:08:50 +0200 Subject: [PATCH] fix: revert prisma client teardown (#365) --- .changeset/neat-walls-train.md | 5 +++++ cli/src/installers/trpc.ts | 5 +---- cli/template/addons/trpc/api-handler-prisma.ts | 12 ------------ 3 files changed, 6 insertions(+), 16 deletions(-) create mode 100644 .changeset/neat-walls-train.md delete mode 100644 cli/template/addons/trpc/api-handler-prisma.ts diff --git a/.changeset/neat-walls-train.md b/.changeset/neat-walls-train.md new file mode 100644 index 0000000000..88a97fe5e2 --- /dev/null +++ b/.changeset/neat-walls-train.md @@ -0,0 +1,5 @@ +--- +"create-t3-app": patch +--- + +revert prisma cleint teardown from #353 diff --git a/cli/src/installers/trpc.ts b/cli/src/installers/trpc.ts index 539efd185c..a0f09515fc 100644 --- a/cli/src/installers/trpc.ts +++ b/cli/src/installers/trpc.ts @@ -23,10 +23,7 @@ export const trpcInstaller: Installer = async ({ const trpcAssetDir = path.join(PKG_ROOT, "template/addons/trpc"); - const apiHandlerSrc = path.join( - trpcAssetDir, - usingPrisma ? "api-handler-prisma.ts" : "api-handler.ts", - ); + const apiHandlerSrc = path.join(trpcAssetDir, "api-handler.ts"); const apiHandlerDest = path.join(projectDir, "src/pages/api/trpc/[trpc].ts"); const utilsSrc = path.join(trpcAssetDir, "utils.ts"); diff --git a/cli/template/addons/trpc/api-handler-prisma.ts b/cli/template/addons/trpc/api-handler-prisma.ts deleted file mode 100644 index 2ca9578b60..0000000000 --- a/cli/template/addons/trpc/api-handler-prisma.ts +++ /dev/null @@ -1,12 +0,0 @@ -// src/pages/api/trpc/[trpc].ts -import { createNextApiHandler } from "@trpc/server/adapters/next"; -import { prisma } from "../../../server/db/client"; -import { appRouter } from "../../../server/router"; -import { createContext } from "../../../server/router/context"; - -// export API handler -export default createNextApiHandler({ - router: appRouter, - createContext, - teardown: () => prisma.$disconnect(), -});