2020-07-17 10:03:38 +02:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
|
|
|
provider = "postgresql"
|
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
2020-07-23 05:45:09 +02:00
|
|
|
model account {
|
2022-10-01 07:27:47 +02:00
|
|
|
user_id Int @id @default(autoincrement())
|
|
|
|
username String @unique @db.VarChar(255)
|
|
|
|
password String @db.VarChar(60)
|
|
|
|
is_admin Boolean @default(false)
|
|
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
|
|
updated_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
|
|
account_uuid String @unique @db.Uuid
|
|
|
|
website website[]
|
2020-07-23 05:45:09 +02:00
|
|
|
}
|
|
|
|
|
2020-07-17 10:03:38 +02:00
|
|
|
model event {
|
2022-08-30 09:03:22 +02:00
|
|
|
event_id Int @id @default(autoincrement())
|
|
|
|
website_id Int
|
|
|
|
session_id Int
|
2022-07-28 02:13:53 +02:00
|
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
|
|
url String @db.VarChar(500)
|
|
|
|
event_name String @db.VarChar(50)
|
2022-08-18 02:35:52 +02:00
|
|
|
session session @relation(fields: [session_id], references: [session_id])
|
|
|
|
website website @relation(fields: [website_id], references: [website_id])
|
2022-08-02 05:50:14 +02:00
|
|
|
event_data event_data?
|
2020-07-18 04:33:40 +02:00
|
|
|
|
2022-06-27 19:30:38 +02:00
|
|
|
@@index([created_at])
|
|
|
|
@@index([session_id])
|
2022-08-01 21:22:17 +02:00
|
|
|
@@index([website_id])
|
|
|
|
}
|
|
|
|
|
2022-07-28 02:13:53 +02:00
|
|
|
model event_data {
|
2022-08-30 09:03:22 +02:00
|
|
|
event_data_id Int @id @default(autoincrement())
|
|
|
|
event_id Int @unique
|
2022-08-02 05:50:14 +02:00
|
|
|
event_data Json
|
2022-08-30 09:03:22 +02:00
|
|
|
event event @relation(fields: [event_id], references: [event_id])
|
2022-07-28 02:13:53 +02:00
|
|
|
}
|
|
|
|
|
2020-07-17 10:03:38 +02:00
|
|
|
model pageview {
|
2022-08-30 09:03:22 +02:00
|
|
|
view_id Int @id @default(autoincrement())
|
|
|
|
website_id Int
|
|
|
|
session_id Int
|
2021-03-20 13:01:10 +01:00
|
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
|
|
url String @db.VarChar(500)
|
|
|
|
referrer String? @db.VarChar(500)
|
2022-08-18 02:35:52 +02:00
|
|
|
session session @relation(fields: [session_id], references: [session_id])
|
|
|
|
website website @relation(fields: [website_id], references: [website_id])
|
2020-07-18 04:33:40 +02:00
|
|
|
|
2022-06-27 19:30:38 +02:00
|
|
|
@@index([created_at])
|
|
|
|
@@index([session_id])
|
|
|
|
@@index([website_id, created_at])
|
|
|
|
@@index([website_id])
|
|
|
|
@@index([website_id, session_id, created_at])
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model session {
|
2022-08-30 09:03:22 +02:00
|
|
|
session_id Int @id @default(autoincrement())
|
2022-07-28 02:13:53 +02:00
|
|
|
session_uuid String @unique @db.Uuid
|
2022-08-30 09:03:22 +02:00
|
|
|
website_id Int
|
2021-03-20 13:01:10 +01:00
|
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
|
|
|
hostname String? @db.VarChar(100)
|
|
|
|
browser String? @db.VarChar(20)
|
|
|
|
os String? @db.VarChar(20)
|
2022-07-27 21:03:12 +02:00
|
|
|
device String? @db.VarChar(20)
|
2021-03-20 13:01:10 +01:00
|
|
|
screen String? @db.VarChar(11)
|
|
|
|
language String? @db.VarChar(35)
|
|
|
|
country String? @db.Char(2)
|
2022-08-18 02:35:52 +02:00
|
|
|
website website @relation(fields: [website_id], references: [website_id])
|
2022-08-01 21:22:17 +02:00
|
|
|
event event[]
|
2022-08-30 09:03:22 +02:00
|
|
|
pageview pageview[]
|
2020-07-18 04:33:40 +02:00
|
|
|
|
2022-06-27 19:30:38 +02:00
|
|
|
@@index([created_at])
|
|
|
|
@@index([website_id])
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model website {
|
2022-08-30 09:03:22 +02:00
|
|
|
website_id Int @id @default(autoincrement())
|
2022-07-28 02:13:53 +02:00
|
|
|
website_uuid String @unique @db.Uuid
|
2022-08-30 09:03:22 +02:00
|
|
|
user_id Int
|
2022-07-27 21:03:12 +02:00
|
|
|
name String @db.VarChar(100)
|
2022-07-15 07:57:38 +02:00
|
|
|
domain String? @db.VarChar(500)
|
2022-07-28 02:13:53 +02:00
|
|
|
share_id String? @unique @db.VarChar(64)
|
2022-07-27 21:03:12 +02:00
|
|
|
created_at DateTime? @default(now()) @db.Timestamptz(6)
|
2022-08-18 02:35:52 +02:00
|
|
|
account account @relation(fields: [user_id], references: [user_id])
|
2022-08-30 09:03:22 +02:00
|
|
|
event event[]
|
2020-07-19 08:54:25 +02:00
|
|
|
pageview pageview[]
|
|
|
|
session session[]
|
2020-08-12 09:23:03 +02:00
|
|
|
|
2022-06-27 19:30:38 +02:00
|
|
|
@@index([user_id])
|
2022-07-15 07:57:38 +02:00
|
|
|
}
|