2020-07-17 10:03:38 +02:00
|
|
|
generator client {
|
|
|
|
provider = "prisma-client-js"
|
|
|
|
}
|
|
|
|
|
|
|
|
datasource db {
|
2020-08-12 09:23:03 +02:00
|
|
|
provider = "mysql"
|
2020-07-17 10:03:38 +02:00
|
|
|
url = env("DATABASE_URL")
|
|
|
|
}
|
|
|
|
|
2020-07-23 05:45:09 +02:00
|
|
|
model account {
|
2021-03-20 13:01:10 +01:00
|
|
|
user_id Int @id @default(autoincrement()) @db.UnsignedInt
|
2022-06-27 20:19:55 +02:00
|
|
|
username String @unique(map: "username") @db.VarChar(255)
|
2021-03-20 13:01:10 +01:00
|
|
|
password String @db.VarChar(60)
|
2020-08-07 04:14:44 +02:00
|
|
|
is_admin Boolean @default(false)
|
2021-03-20 13:01:10 +01:00
|
|
|
created_at DateTime? @default(now()) @db.Timestamp(0)
|
|
|
|
updated_at DateTime? @default(now()) @db.Timestamp(0)
|
2020-07-23 05:45:09 +02:00
|
|
|
website website[]
|
|
|
|
}
|
|
|
|
|
2020-07-17 10:03:38 +02:00
|
|
|
model event {
|
2021-03-20 13:01:10 +01:00
|
|
|
event_id Int @id @default(autoincrement()) @db.UnsignedInt
|
|
|
|
website_id Int @db.UnsignedInt
|
|
|
|
session_id Int @db.UnsignedInt
|
|
|
|
created_at DateTime? @default(now()) @db.Timestamp(0)
|
|
|
|
url String @db.VarChar(500)
|
|
|
|
event_type String @db.VarChar(50)
|
|
|
|
event_value String @db.VarChar(50)
|
2022-06-27 20:19:55 +02:00
|
|
|
session session @relation(fields: [session_id], references: [session_id], onDelete: Cascade, onUpdate: NoAction, map: "event_ibfk_2")
|
|
|
|
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade, onUpdate: NoAction, map: "event_ibfk_1")
|
2020-07-18 04:33:40 +02:00
|
|
|
|
2022-06-27 20:19:55 +02:00
|
|
|
@@index([created_at])
|
|
|
|
@@index([session_id])
|
|
|
|
@@index([website_id])
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model pageview {
|
2021-03-20 13:01:10 +01:00
|
|
|
view_id Int @id @default(autoincrement()) @db.UnsignedInt
|
|
|
|
website_id Int @db.UnsignedInt
|
|
|
|
session_id Int @db.UnsignedInt
|
|
|
|
created_at DateTime? @default(now()) @db.Timestamp(0)
|
|
|
|
url String @db.VarChar(500)
|
|
|
|
referrer String? @db.VarChar(500)
|
2022-06-27 20:19:55 +02:00
|
|
|
session session @relation(fields: [session_id], references: [session_id], onDelete: Cascade, onUpdate: NoAction, map: "pageview_ibfk_2")
|
|
|
|
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade, onUpdate: NoAction, map: "pageview_ibfk_1")
|
2020-07-18 04:33:40 +02:00
|
|
|
|
2022-06-27 20:19:55 +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 {
|
2021-03-20 13:01:10 +01:00
|
|
|
session_id Int @id @default(autoincrement()) @db.UnsignedInt
|
2022-06-27 20:19:55 +02:00
|
|
|
session_uuid String @unique(map: "session_uuid") @db.VarChar(36)
|
2021-03-20 13:01:10 +01:00
|
|
|
website_id Int @db.UnsignedInt
|
|
|
|
created_at DateTime? @default(now()) @db.Timestamp(0)
|
|
|
|
hostname String? @db.VarChar(100)
|
|
|
|
browser String? @db.VarChar(20)
|
|
|
|
os String? @db.VarChar(20)
|
|
|
|
device String? @db.VarChar(20)
|
|
|
|
screen String? @db.VarChar(11)
|
|
|
|
language String? @db.VarChar(35)
|
|
|
|
country String? @db.Char(2)
|
2022-06-27 20:19:55 +02:00
|
|
|
website website @relation(fields: [website_id], references: [website_id], onDelete: Cascade, onUpdate: NoAction, map: "session_ibfk_1")
|
2020-07-19 08:54:25 +02:00
|
|
|
event event[]
|
|
|
|
pageview pageview[]
|
2020-07-18 04:33:40 +02:00
|
|
|
|
2022-06-27 20:19:55 +02:00
|
|
|
@@index([created_at])
|
|
|
|
@@index([website_id])
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
model website {
|
2021-03-20 13:01:10 +01:00
|
|
|
website_id Int @id @default(autoincrement()) @db.UnsignedInt
|
2022-06-27 20:19:55 +02:00
|
|
|
website_uuid String @unique(map: "website_uuid") @db.VarChar(36)
|
2021-03-20 13:01:10 +01:00
|
|
|
user_id Int @db.UnsignedInt
|
|
|
|
name String @db.VarChar(100)
|
|
|
|
domain String? @db.VarChar(500)
|
2022-06-27 20:19:55 +02:00
|
|
|
share_id String? @unique(map: "share_id") @db.VarChar(64)
|
2021-03-20 13:01:10 +01:00
|
|
|
created_at DateTime? @default(now()) @db.Timestamp(0)
|
2022-06-27 20:19:55 +02:00
|
|
|
account account @relation(fields: [user_id], references: [user_id], onDelete: Cascade, onUpdate: NoAction, map: "website_ibfk_1")
|
2020-07-19 08:54:25 +02:00
|
|
|
event event[]
|
|
|
|
pageview pageview[]
|
|
|
|
session session[]
|
2020-08-12 09:23:03 +02:00
|
|
|
|
2022-06-27 20:19:55 +02:00
|
|
|
@@index([user_id])
|
2020-07-17 10:03:38 +02:00
|
|
|
}
|