forked from umami-software/umami
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.postgresql.prisma
85 lines (75 loc) · 2.42 KB
/
schema.postgresql.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
73
74
75
76
77
78
79
80
81
82
83
84
85
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model account {
user_id Int @default(autoincrement()) @id
username String @unique
password String
is_admin Boolean @default(false)
created_at DateTime? @default(now())
updated_at DateTime? @default(now())
website website[]
}
model event {
event_id Int @default(autoincrement()) @id
website_id Int
session_id Int
created_at DateTime? @default(now())
url String
event_type String
event_value String
session session @relation(fields: [session_id], references: [session_id])
website website @relation(fields: [website_id], references: [website_id])
@@index([created_at], name: "event_created_at_idx")
@@index([session_id], name: "event_session_id_idx")
@@index([website_id], name: "event_website_id_idx")
}
model pageview {
view_id Int @default(autoincrement()) @id
website_id Int
session_id Int
created_at DateTime? @default(now())
url String
referrer String?
session session @relation(fields: [session_id], references: [session_id])
website website @relation(fields: [website_id], references: [website_id])
@@index([created_at], name: "pageview_created_at_idx")
@@index([session_id], name: "pageview_session_id_idx")
@@index([website_id], name: "pageview_website_id_idx")
}
model session {
session_id Int @default(autoincrement()) @id
session_uuid String @unique
website_id Int
created_at DateTime? @default(now())
hostname String?
browser String?
os String?
screen String?
language String?
country String?
device String?
website website @relation(fields: [website_id], references: [website_id])
event event[]
pageview pageview[]
@@index([created_at], name: "session_created_at_idx")
@@index([website_id], name: "session_website_id_idx")
}
model website {
website_id Int @default(autoincrement()) @id
website_uuid String @unique
name String
created_at DateTime? @default(now())
user_id Int
domain String?
share_id String? @unique
account account @relation(fields: [user_id], references: [user_id])
event event[]
pageview pageview[]
session session[]
@@index([user_id], name: "website_user_id_idx")
}