mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 17:15:37 +01:00
Feat/um 202 event data new (#1841)
* Add event_data base. * Add url_path. * Add eventData back. * Finish event_data relational. * resolve comments.
This commit is contained in:
parent
c2789d70bc
commit
9979672de5
27 changed files with 719 additions and 130 deletions
|
|
@ -83,23 +83,17 @@ CREATE TABLE `event_data` (
|
|||
`event_id` VARCHAR(36) NOT NULL,
|
||||
`website_event_id` VARCHAR(36) NOT NULL,
|
||||
`website_id` VARCHAR(36) NOT NULL,
|
||||
`session_id` VARCHAR(36) NOT NULL,
|
||||
`url_path` VARCHAR(500) NOT NULL,
|
||||
`event_name` VARCHAR(500) NOT NULL,
|
||||
`event_key` VARCHAR(500) NOT NULL,
|
||||
`event_string_value` VARCHAR(500) NOT NULL,
|
||||
`event_numeric_value` DECIMAL(19, 4) NOT NULL,
|
||||
`event_string_value` VARCHAR(500) NULL,
|
||||
`event_numeric_value` DECIMAL(19, 4) NULL,
|
||||
`event_date_value` TIMESTAMP(0) NULL,
|
||||
`event_data_type` INTEGER UNSIGNED NOT NULL,
|
||||
`created_at` TIMESTAMP(0) NULL DEFAULT CURRENT_TIMESTAMP(0),
|
||||
|
||||
INDEX `event_data_created_at_idx`(`created_at`),
|
||||
INDEX `event_data_session_id_idx`(`session_id`),
|
||||
INDEX `event_data_website_id_idx`(`website_id`),
|
||||
INDEX `event_data_website_event_id_idx`(`website_event_id`),
|
||||
INDEX `event_data_website_id_website_event_id_created_at_idx`(`website_id`, `website_event_id`, `created_at`),
|
||||
INDEX `event_data_website_id_session_id_created_at_idx`(`website_id`, `session_id`, `created_at`),
|
||||
INDEX `event_data_website_id_session_id_website_event_id_created_at_idx`(`website_id`, `session_id`, `website_event_id`, `created_at`),
|
||||
PRIMARY KEY (`event_id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,29 +17,28 @@ model User {
|
|||
updatedAt DateTime? @map("updated_at") @db.Timestamp(0)
|
||||
deletedAt DateTime? @map("deleted_at") @db.Timestamp(0)
|
||||
|
||||
website Website[]
|
||||
teamUser TeamUser[]
|
||||
website Website[]
|
||||
teamUser TeamUser[]
|
||||
|
||||
@@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)
|
||||
subdivision1 String? @db.Char(3)
|
||||
subdivision2 String? @db.VarChar(50)
|
||||
city String? @db.VarChar(50)
|
||||
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)
|
||||
subdivision1 String? @db.Char(3)
|
||||
subdivision2 String? @db.VarChar(50)
|
||||
city String? @db.VarChar(50)
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)
|
||||
|
||||
websiteEvent WebsiteEvent[]
|
||||
eventData EventData[]
|
||||
|
||||
@@index([createdAt])
|
||||
@@index([websiteId])
|
||||
|
|
@ -96,27 +95,20 @@ model EventData {
|
|||
id String @id() @map("event_id") @db.VarChar(36)
|
||||
websiteEventId String @map("website_event_id") @db.VarChar(36)
|
||||
websiteId String @map("website_id") @db.VarChar(36)
|
||||
sessionId String @map("session_id") @db.VarChar(36)
|
||||
urlPath String @map("url_path") @db.VarChar(500)
|
||||
eventName String @map("event_name") @db.VarChar(500)
|
||||
eventKey String @map("event_key") @db.VarChar(500)
|
||||
eventStringValue String @map("event_string_value") @db.VarChar(500)
|
||||
eventNumericValue Decimal @map("event_numeric_value") @db.Decimal(19,4)
|
||||
eventStringValue String? @map("event_string_value") @db.VarChar(500)
|
||||
eventNumericValue Decimal? @map("event_numeric_value") @db.Decimal(19, 4)
|
||||
eventDateValue DateTime? @map("event_date_value") @db.Timestamp(0)
|
||||
eventDataType Int @map("event_data_type") @db.UnsignedInt
|
||||
createdAt DateTime? @default(now()) @map("created_at")@db.Timestamp(0)
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)
|
||||
|
||||
website Website @relation(fields: [websiteId], references: [id])
|
||||
websiteEvent WebsiteEvent @relation(fields: [websiteEventId], references: [id])
|
||||
session Session @relation(fields: [sessionId], references: [id])
|
||||
|
||||
@@index([createdAt])
|
||||
@@index([sessionId])
|
||||
@@index([websiteId])
|
||||
@@index([websiteEventId])
|
||||
@@index([websiteId, websiteEventId, createdAt])
|
||||
@@index([websiteId, sessionId, createdAt])
|
||||
@@index([websiteId, sessionId, websiteEventId, createdAt])
|
||||
@@map("event_data")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue