mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
Feat/um 305 unique session ch (#2065)
* Add session_data / session redis to CH. * Add mysql migration.
This commit is contained in:
parent
1038a54fe4
commit
b484286523
23 changed files with 405 additions and 300 deletions
31
db/postgresql/migrations/03_session_data/migration.sql
Normal file
31
db/postgresql/migrations/03_session_data/migration.sql
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "event_data" RENAME COLUMN "event_data_type" TO "data_type";
|
||||
ALTER TABLE "event_data" RENAME COLUMN "event_date_value" TO "date_value";
|
||||
ALTER TABLE "event_data" RENAME COLUMN "event_id" TO "event_data_id";
|
||||
ALTER TABLE "event_data" RENAME COLUMN "event_numeric_value" TO "numeric_value";
|
||||
ALTER TABLE "event_data" RENAME COLUMN "event_string_value" TO "string_value";
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "session_data" (
|
||||
"session_data_id" UUID NOT NULL,
|
||||
"website_id" UUID NOT NULL,
|
||||
"session_id" UUID NOT NULL,
|
||||
"session_key" VARCHAR(500) NOT NULL,
|
||||
"string_value" VARCHAR(500),
|
||||
"numeric_value" DECIMAL(19,4),
|
||||
"date_value" TIMESTAMPTZ(6),
|
||||
"data_type" INTEGER NOT NULL,
|
||||
"created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
|
||||
"deleted_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "session_data_pkey" PRIMARY KEY ("session_data_id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "session_data_created_at_idx" ON "session_data"("created_at");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "session_data_website_id_idx" ON "session_data"("website_id");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "session_data_session_id_idx" ON "session_data"("session_id");
|
||||
|
|
@ -19,7 +19,7 @@ model User {
|
|||
|
||||
website Website[]
|
||||
teamUser TeamUser[]
|
||||
Report Report[]
|
||||
report Report[]
|
||||
|
||||
@@map("user")
|
||||
}
|
||||
|
|
@ -40,6 +40,7 @@ model Session {
|
|||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||
|
||||
websiteEvent WebsiteEvent[]
|
||||
sessionData SessionData[]
|
||||
|
||||
@@index([createdAt])
|
||||
@@index([websiteId])
|
||||
|
|
@ -60,7 +61,8 @@ model Website {
|
|||
user User? @relation(fields: [userId], references: [id])
|
||||
teamWebsite TeamWebsite[]
|
||||
eventData EventData[]
|
||||
Report Report[]
|
||||
report Report[]
|
||||
sessionData SessionData[]
|
||||
|
||||
@@index([userId])
|
||||
@@index([createdAt])
|
||||
|
|
@ -94,15 +96,15 @@ model WebsiteEvent {
|
|||
}
|
||||
|
||||
model EventData {
|
||||
id String @id() @map("event_id") @db.Uuid
|
||||
websiteId String @map("website_id") @db.Uuid
|
||||
websiteEventId String @map("website_event_id") @db.Uuid
|
||||
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)
|
||||
eventDateValue DateTime? @map("event_date_value") @db.Timestamptz(6)
|
||||
eventDataType Int @map("event_data_type") @db.Integer
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||
id String @id() @map("event_data_id") @db.Uuid
|
||||
websiteId String @map("website_id") @db.Uuid
|
||||
websiteEventId String @map("website_event_id") @db.Uuid
|
||||
eventKey String @map("event_key") @db.VarChar(500)
|
||||
stringValue String? @map("string_value") @db.VarChar(500)
|
||||
numericValue Decimal? @map("numeric_value") @db.Decimal(19, 4)
|
||||
dateValue DateTime? @map("date_value") @db.Timestamptz(6)
|
||||
dataType Int @map("data_type") @db.Integer
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||
|
||||
website Website @relation(fields: [websiteId], references: [id])
|
||||
websiteEvent WebsiteEvent @relation(fields: [websiteEventId], references: [id])
|
||||
|
|
@ -113,6 +115,27 @@ model EventData {
|
|||
@@map("event_data")
|
||||
}
|
||||
|
||||
model SessionData {
|
||||
id String @id() @map("session_data_id") @db.Uuid
|
||||
websiteId String @map("website_id") @db.Uuid
|
||||
sessionId String @map("session_id") @db.Uuid
|
||||
sessionKey String @map("session_key") @db.VarChar(500)
|
||||
stringValue String? @map("string_value") @db.VarChar(500)
|
||||
numericValue Decimal? @map("numeric_value") @db.Decimal(19, 4)
|
||||
dateValue DateTime? @map("date_value") @db.Timestamptz(6)
|
||||
dataType Int @map("data_type") @db.Integer
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||
deletedAt DateTime? @default(now()) @map("deleted_at") @db.Timestamptz(6)
|
||||
|
||||
website Website @relation(fields: [websiteId], references: [id])
|
||||
session Session @relation(fields: [sessionId], references: [id])
|
||||
|
||||
@@index([createdAt])
|
||||
@@index([websiteId])
|
||||
@@index([sessionId])
|
||||
@@map("session_data")
|
||||
}
|
||||
|
||||
model Team {
|
||||
id String @id() @unique() @map("team_id") @db.Uuid
|
||||
name String @db.VarChar(50)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue