Skip to content

Commit

Permalink
added prisma and neon
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutlope committed Aug 8, 2024
1 parent a186837 commit d04ecb1
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 131 deletions.
12 changes: 1 addition & 11 deletions app/share/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,8 @@ async function getCode(id: string) {
return sampleCode;
}

/*
Database schemahttp://localhost:3000/_next/image?url=%2F_next%2Fstatic%2Fmedia%2Fhalo.c1bc0835.png&w=3840&q=75
id (@uuid) | model (TEXT) | prompt (TEXT) | code (TEXT) | createdAt (auto datetime)
-------------------------------------------------------------------------------------
abkens | llama-405b | Build me a.... | function.... | now()
islkns | llama-405b | Build me a.... | function.... | now()
Index on ID
*/

export default async function Page({ params }: { params: { id: string } }) {
// if process.env.DATABASE_URL is not set, throw an error
if (typeof params.id !== "string") {
notFound();
}
Expand Down
10 changes: 10 additions & 0 deletions lib/prisma.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PrismaClient } from "@prisma/client";

declare global {
var prisma: PrismaClient | undefined;
}

const client = globalThis.prisma || new PrismaClient();
if (process.env.NODE_ENV !== "production") globalThis.prisma = client;

export default client;
320 changes: 200 additions & 120 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d04ecb1

Please sign in to comment.