forked from umami-software/umami
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f159ed
commit f10694d
Showing
2 changed files
with
199 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
datasource db { | ||
provider = "mysql" | ||
url = env("DATABASE_URL") | ||
relationMode = "prisma" | ||
} | ||
|
||
model User { | ||
id String @id @unique @map("user_id") @db.VarChar(36) | ||
username String @unique @db.VarChar(255) | ||
password String @db.VarChar(60) | ||
role String @map("role") @db.VarChar(50) | ||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6) | ||
updatedAt DateTime? @map("updated_at") @db.Timestamptz(0) | ||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(0) | ||
teamUser TeamUser[] | ||
Website Website[] | ||
@@map("user") | ||
} | ||
|
||
model Session { | ||
id String @id @unique @map("session_id") @db.VarChar(36) | ||
websiteId String @map("website_id") @db.VarChar(36) | ||
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) | ||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(0) | ||
@@index([createdAt]) | ||
@@index([websiteId]) | ||
@@map("session") | ||
} | ||
|
||
model Website { | ||
id String @id @unique @map("website_id") @db.VarChar(36) | ||
name String @db.VarChar(100) | ||
domain String? @db.VarChar(500) | ||
shareId String? @unique @map("share_id") @db.VarChar(50) | ||
revId Int @default(0) @map("rev_id") @db.UnsignedInt | ||
userId String? @map("user_id") @db.VarChar(36) | ||
teamId String? @map("team_id") @db.VarChar(36) | ||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(0) | ||
updatedAt DateTime? @map("updated_at") @db.Timestamptz(0) | ||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(0) | ||
team Team? @relation(fields: [teamId], references: [id]) | ||
user User? @relation(fields: [userId], references: [id]) | ||
@@index([teamId]) | ||
@@index([userId]) | ||
@@index([createdAt]) | ||
@@index([shareId]) | ||
@@map("website") | ||
} | ||
|
||
model WebsiteEvent { | ||
id String @id() @map("event_id") @db.VarChar(36) | ||
websiteId String @map("website_id") @db.VarChar(36) | ||
sessionId String @map("session_id") @db.VarChar(36) | ||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(0) | ||
url String @db.VarChar(500) | ||
referrer String? @db.VarChar(500) | ||
eventType Int @default(1) @map("event_type") @db.UnsignedInt | ||
eventName String? @map("event_name") @db.VarChar(50) | ||
eventData Json? @map("event_data") | ||
@@index([createdAt]) | ||
@@index([sessionId]) | ||
@@index([websiteId]) | ||
@@index([websiteId, createdAt]) | ||
@@index([websiteId, sessionId, createdAt]) | ||
@@map("website_event") | ||
} | ||
|
||
model Team { | ||
id String @id() @unique() @map("team_id") @db.VarChar(36) | ||
name String @db.VarChar(50) | ||
userId String @map("user_id") @db.VarChar(36) | ||
accessCode String? @unique @map("access_code") @db.VarChar(50) | ||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(0) | ||
updatedAt DateTime? @map("updated_at") @db.Timestamptz(0) | ||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(0) | ||
teamUsers TeamUser[] | ||
Website Website[] | ||
@@index([userId]) | ||
@@index([accessCode]) | ||
@@map("team") | ||
} | ||
|
||
model TeamUser { | ||
id String @id() @unique() @map("team_user_id") @db.VarChar(36) | ||
teamId String @map("team_id") @db.VarChar(36) | ||
userId String @map("user_id") @db.VarChar(36) | ||
role String @map("role") @db.VarChar(50) | ||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(0) | ||
updatedAt DateTime? @map("updated_at") @db.Timestamptz(0) | ||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(0) | ||
team Team @relation(fields: [teamId], references: [id]) | ||
user User @relation(fields: [userId], references: [id]) | ||
@@index([teamId]) | ||
@@index([userId]) | ||
@@map("team_user") | ||
} |