Skip to content

Commit 0465612

Browse files
committed
fixing schema and updating readme
1 parent 7d719e6 commit 0465612

File tree

4 files changed

+34
-27
lines changed

4 files changed

+34
-27
lines changed

examples/prisma/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ next-env.d.ts
3636

3737
# env
3838
.env
39+
40+
# prisma
41+
prisma/migrations/**

examples/prisma/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ Along side the `.env.example` file in this example app, create a `.env` file wit
1818

1919
Run `npm i` to install dependencies.
2020

21+
Run `npm run db:generate` and `npm run db:migrate`
22+
2123
Run `npm run dev` to launch the dev server and visit `localhost:3000` to view the app.

examples/prisma/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"lint": "next lint",
1010
"db:init": "prisma init",
1111
"db:generate": "prisma generate",
12-
"db:migrate": "prisma migrate dev --name init"
12+
"db:migrate": "prisma migrate dev"
1313
},
1414
"dependencies": {
1515
"@next-auth/prisma-adapter": "^1.0.7",

examples/prisma/prisma/schema.prisma

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,53 @@ model Pubkey {
1919
}
2020

2121
model Account {
22-
id String @id @default(cuid())
23-
userId String
24-
providerType String
25-
providerId String
26-
providerAccountId String
27-
refreshToken String?
28-
accessToken String?
29-
accessTokenExpires DateTime?
30-
createdAt DateTime @default(now())
31-
updatedAt DateTime @updatedAt
32-
user User @relation(fields: [userId], references: [id])
22+
id String @id @default(cuid())
23+
userId String @map("user_id")
24+
type String
25+
provider String
26+
providerAccountId String @map("provider_account_id")
27+
refresh_token String? @db.Text
28+
access_token String? @db.Text
29+
expires_at Int?
30+
token_type String?
31+
scope String?
32+
id_token String? @db.Text
33+
session_state String?
34+
success Boolean?
3335
34-
@@unique([providerId, providerAccountId])
36+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
37+
38+
@@unique([provider, providerAccountId])
39+
@@map("accounts")
3540
}
3641

3742
model Session {
3843
id String @id @default(cuid())
39-
userId String
44+
sessionToken String @unique @map("session_token")
45+
userId String @map("user_id")
4046
expires DateTime
41-
sessionToken String @unique
42-
accessToken String @unique
43-
createdAt DateTime @default(now())
44-
updatedAt DateTime @updatedAt
45-
user User @relation(fields: [userId], references: [id])
47+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
48+
49+
@@map("sessions")
4650
}
4751

4852
model User {
4953
id String @id @default(cuid())
5054
name String?
5155
email String? @unique
52-
emailVerified DateTime?
56+
emailVerified DateTime? @map("email_verified")
5357
image String?
54-
createdAt DateTime @default(now())
55-
updatedAt DateTime @updatedAt
5658
accounts Account[]
5759
sessions Session[]
60+
61+
@@map("users")
5862
}
5963

60-
model VerificationRequest {
61-
id String @id @default(cuid())
64+
model VerificationToken {
6265
identifier String
63-
token String @unique
66+
token String
6467
expires DateTime
65-
createdAt DateTime @default(now())
66-
updatedAt DateTime @updatedAt
6768
6869
@@unique([identifier, token])
70+
@@map("verification_tokens")
6971
}

0 commit comments

Comments
 (0)