-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathschema.prisma
72 lines (58 loc) · 2.16 KB
/
schema.prisma
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
}
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
email String @unique
name String?
username String @unique
password String
isActive Boolean? @map("is_active")
account Account[]
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @default(now()) @map("updated_at")
deletedAt DateTime? @map("deleted_at")
@@map("users")
}
model Account {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String?
username String?
socialMediaUserId String? @map("social_media_user_id") //Referes to the social media user id -> Twitter ID
avatarUrl String? @map("avatar_url")
userId String? @map("user_id") @db.ObjectId
favorite Boolean
socialMediaId String @map("social_media_id") @db.ObjectId
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User? @relation(fields: [userId], references: [id])
socialMedia SocialMedia? @relation(fields: [socialMediaId], references: [id])
token Token?
@@map("accounts")
}
model Token {
id String @id @default(auto()) @map("_id") @db.ObjectId
authToken String? @map("auth_token")
token String?
issuedAt DateTime? @map("issued_at")
expiresIn Int? @map("expire_in")
accountId String @unique @map("account_id") @db.ObjectId
account Account? @relation(fields: [accountId], references: [id])
@@map("tokens")
}
model SocialMedia {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
description String?
account Account[]
@@map("social_media")
}