From e5c0c4cf4cba264d1f1fb13160337bb239391a67 Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Thu, 19 Dec 2024 20:52:44 -0500 Subject: [PATCH] prisma scripts --- package.json | 8 +++++--- prisma/schema.prisma | 34 +++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 0c3a333..9df9397 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,10 @@ "storybook": "storybook dev -p 6006", "build-storybook": "storybook build", "test:e2e": "playwright test", + "prisma:push": "prisma db push", + "prisma:format": "prisma format", "prisma:generate": "prisma generate", - "prisma:dev": "prisma migrate dev", + "prisma:reset": "prisma migrate reset --force", "prisma:studio": "prisma studio" }, "devDependencies": { @@ -57,7 +59,7 @@ }, "dependencies": { "@flaticon/flaticon-uicons": "^3.3.1", - "@lucia-auth/adapter-prisma": "^4.0.1", + "@lucia-auth/adapter-prisma": "^4.0.1", "@pothos/core": "^4.3.0", "@pothos/plugin-prisma": "^4.4.0", "@prisma/client": "6.0.1", @@ -72,4 +74,4 @@ "tailwind-merge": "^2.5.5", "zod": "^3.24.0" } -} \ No newline at end of file +} diff --git a/prisma/schema.prisma b/prisma/schema.prisma index bdf9ac4..4449dae 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -15,34 +15,38 @@ datasource db { } model User { - id String @id @default(uuid()) - email String? @unique - name String - password String - posts Post[] - sessions Session[] + id String @id @default(uuid()) + + email String? @unique + name String + password String + posts Post[] + sessions Session[] createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @updatedAt } model Session { - id String @id @default(uuid()) - expiresAt DateTime - createdAt DateTime @default(now()) - updatedAt DateTime @default(now()) @updatedAt - userId String - user User @relation(references: [id], fields: [userId]) + id String @id @default(uuid()) + + expiresAt DateTime + user User @relation(references: [id], fields: [userId]) + userId String + + createdAt DateTime @default(now()) + updatedAt DateTime @default(now()) @updatedAt } - model Post { - id String @id @default(uuid()) + id String @id @default(uuid()) + title String content String published Boolean? @default(false) author User @relation(references: [id], fields: [authorId]) authorId String + createdAt DateTime @default(now()) updatedAt DateTime @default(now()) @updatedAt -} \ No newline at end of file +}