Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@next-auth/prisma-adapter

Package Overview
Dependencies
Maintainers
4
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@next-auth/prisma-adapter

Prisma adapter for next-auth.

  • 0.4.4-canary.16
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
62K
decreased by-28.12%
Maintainers
4
Weekly downloads
 
Created
Source

Prisma Adapter

model Account {
  id                 Int       @id @default(autoincrement())
  userId             Int
  providerType       String
  providerId         String
  providerAccountId  String
  refreshToken       String?
  accessToken        String?
  accessTokenExpires DateTime?
  createdAt          DateTime  @default(now())
  updatedAt          DateTime  @updatedAt
  user               User      @relation(fields: [userId], references: [id])

  @@unique([providerId, providerAccountId])
}

model Session {
  id           Int      @id @default(autoincrement())
  userId       Int
  expires      DateTime
  sessionToken String   @unique
  accessToken  String   @unique
  createdAt    DateTime @default(now())
  updatedAt    DateTime @updatedAt
  user         User     @relation(fields: [userId], references: [id])
}

model User {
  id            Int       @id @default(autoincrement())
  name          String?
  email         String?   @unique
  emailVerified DateTime?
  image         String?
  createdAt     DateTime  @default(now())
  updatedAt     DateTime  @updatedAt
  accounts      Account[]
  sessions      Session[]
}

model VerificationRequest {
  id         Int      @id @default(autoincrement())
  identifier String
  token      String   @unique
  expires    DateTime
  createdAt  DateTime @default(now())
  updatedAt  DateTime @updatedAt

  @@unique([identifier, token])
}

Changes from the original Prisma Adapter

 model Account {
-  id                 Int       @default(autoincrement()) @id
+  id                 Int       @id @default(autoincrement())
-  compoundId         String    @unique @map(name: "compound_id")
-  userId             Int       @map(name: "user_id")
+  userId             Int
+  user               User      @relation(fields: [userId], references: [id])
-  providerType       String    @map(name: "provider_type")
+  providerType       String
-  providerId         String    @map(name: "provider_id")
+  providerId         String
-  providerAccountId  String    @map(name: "provider_account_id")
+  providerAccountId  String
-  refreshToken       String?   @map(name: "refresh_token")
+  refreshToken       String?
-  accessToken        String?   @map(name: "access_token")
+  accessToken        String?
-  accessTokenExpires DateTime? @map(name: "access_token_expires")
+  accessTokenExpires DateTime?
-  createdAt          DateTime  @default(now()) @map(name: "created_at")
+  createdAt          DateTime  @default(now())
-  updatedAt          DateTime  @default(now()) @map(name: "updated_at")
+  updatedAt          DateTime  @updatedAt

-  @@index([providerAccountId], name: "providerAccountId")
-  @@index([providerId], name: "providerId")
-  @@index([userId], name: "userId")
-  @@map(name: "accounts")
+  @@unique([providerId, providerAccountId])
 }

 model Session {
-  id           Int      @default(autoincrement()) @id
+  id           Int      @id @default(autoincrement())
-  userId       Int      @map(name: "user_id")
+  userId       Int
+  user         User     @relation(fields: [userId], references: [id])
   expires      DateTime
-  sessionToken String   @unique @map(name: "session_token")
+  sessionToken String   @unique
-  accessToken  String   @unique @map(name: "access_token")
+  accessToken  String   @unique
-  createdAt    DateTime @default(now()) @map(name: "created_at")
+  createdAt    DateTime @default(now())
-  updatedAt    DateTime @default(now()) @map(name: "updated_at")
+  updatedAt    DateTime @updatedAt
-
-  @@map(name: "sessions")
 }

 model User {
-  id            Int       @default(autoincrement()) @id
+  id            Int       @id @default(autoincrement())
   name          String?
   email         String?   @unique
-  emailVerified DateTime? @map(name: "email_verified")
+  emailVerified DateTime?
   image         String?
+  accounts      Account[]
+  sessions      Session[]
-  createdAt     DateTime  @default(now()) @map(name: "created_at")
+  createdAt     DateTime  @default(now())
-  updatedAt     DateTime  @default(now()) @map(name: "updated_at")
+  updatedAt     DateTime  @updatedAt

-  @@map(name: "users")
 }

 model VerificationRequest {
-  id         Int      @default(autoincrement()) @id
+  id         Int      @id @default(autoincrement())
   identifier String
   token      String   @unique
   expires    DateTime
-  createdAt  DateTime  @default(now()) @map(name: "created_at")
+  createdAt  DateTime @default(now())
-  updatedAt  DateTime  @default(now()) @map(name: "updated_at")
+  updatedAt  DateTime @updatedAt

-  @@map(name: "verification_requests")
+  @@unique([identifier, token])
 }

Keywords

FAQs

Package last updated on 22 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc