mirror of
https://github.com/umami-software/umami.git
synced 2026-02-18 19:45:35 +01:00
save ip, lat, lng of session
This commit is contained in:
parent
8b108d3aae
commit
d0fb1dd4dd
10 changed files with 101 additions and 12 deletions
4
db/clickhouse/migrations/04_ip_lat_lng.sql
Normal file
4
db/clickhouse/migrations/04_ip_lat_lng.sql
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "session" ADD COLUMN "ip" VARCHAR(40),
|
||||
ADD COLUMN "lat" FLOAT,
|
||||
ADD COLUMN "lng" FLOAT;
|
||||
|
|
@ -16,6 +16,9 @@ CREATE TABLE umami.website_event
|
|||
subdivision1 LowCardinality(String),
|
||||
subdivision2 LowCardinality(String),
|
||||
city String,
|
||||
ip Nullable(String),
|
||||
lat Nullable(Float32),
|
||||
lng Nullable(Float32),
|
||||
--pageviews
|
||||
url_path String,
|
||||
url_query String,
|
||||
|
|
|
|||
9
db/mysql/migrations/07_ip_lat_lng/migration.sql
Normal file
9
db/mysql/migrations/07_ip_lat_lng/migration.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "session" ADD COLUMN "ip" VARCHAR(255),
|
||||
ADD COLUMN "lat" FLOAT,
|
||||
ADD COLUMN "lng" FLOAT;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX `session_website_id_created_at_ip_idx` ON `session`(`website_id`, `created_at`, `ip`);
|
||||
CREATE INDEX `session_website_id_created_at_lat_idx` ON `session`(`website_id`, `created_at`, `lat`);
|
||||
CREATE INDEX `session_website_id_created_at_lng_idx` ON `session`(`website_id`, `created_at`, `lng`);
|
||||
|
|
@ -19,10 +19,10 @@ model User {
|
|||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamp(0)
|
||||
deletedAt DateTime? @map("deleted_at") @db.Timestamp(0)
|
||||
|
||||
websiteUser Website[] @relation("user")
|
||||
websiteCreateUser Website[] @relation("createUser")
|
||||
teamUser TeamUser[]
|
||||
report Report[]
|
||||
websiteUser Website[] @relation("user")
|
||||
websiteCreateUser Website[] @relation("createUser")
|
||||
teamUser TeamUser[]
|
||||
report Report[]
|
||||
|
||||
@@map("user")
|
||||
}
|
||||
|
|
@ -40,6 +40,9 @@ model Session {
|
|||
subdivision1 String? @db.Char(20)
|
||||
subdivision2 String? @db.VarChar(50)
|
||||
city String? @db.VarChar(50)
|
||||
ip String? @db.VarChar(40)
|
||||
lat Float?
|
||||
lng Float?
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)
|
||||
|
||||
websiteEvent WebsiteEvent[]
|
||||
|
|
@ -57,6 +60,9 @@ model Session {
|
|||
@@index([websiteId, createdAt, country])
|
||||
@@index([websiteId, createdAt, subdivision1])
|
||||
@@index([websiteId, createdAt, city])
|
||||
@@index([websiteId, createdAt, ip])
|
||||
@@index([websiteId, createdAt, lat])
|
||||
@@index([websiteId, createdAt, lng])
|
||||
@@map("session")
|
||||
}
|
||||
|
||||
|
|
@ -174,8 +180,8 @@ model Team {
|
|||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamp(0)
|
||||
deletedAt DateTime? @map("deleted_at") @db.Timestamp(0)
|
||||
|
||||
website Website[]
|
||||
teamUser TeamUser[]
|
||||
website Website[]
|
||||
teamUser TeamUser[]
|
||||
|
||||
@@index([accessCode])
|
||||
@@map("team")
|
||||
|
|
|
|||
9
db/postgresql/migrations/07_ip_lat_lng/migration.sql
Normal file
9
db/postgresql/migrations/07_ip_lat_lng/migration.sql
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "session" ADD COLUMN "ip" VARCHAR(40),
|
||||
ADD COLUMN "lat" FLOAT,
|
||||
ADD COLUMN "lng" FLOAT;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "session_website_id_created_at_ip_idx" ON "session"("website_id", "created_at", "ip");
|
||||
CREATE INDEX "session_website_id_created_at_lat_idx" ON "session"("website_id", "created_at", "lat");
|
||||
CREATE INDEX "session_website_id_created_at_lng_idx" ON "session"("website_id", "created_at", "lng");
|
||||
|
|
@ -19,8 +19,8 @@ model User {
|
|||
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamptz(6)
|
||||
deletedAt DateTime? @map("deleted_at") @db.Timestamptz(6)
|
||||
|
||||
websiteUser Website[] @relation("user")
|
||||
websiteCreateUser Website[] @relation("createUser")
|
||||
websiteUser Website[] @relation("user")
|
||||
websiteCreateUser Website[] @relation("createUser")
|
||||
teamUser TeamUser[]
|
||||
report Report[]
|
||||
|
||||
|
|
@ -40,6 +40,9 @@ model Session {
|
|||
subdivision1 String? @db.VarChar(20)
|
||||
subdivision2 String? @db.VarChar(50)
|
||||
city String? @db.VarChar(50)
|
||||
ip String? @db.VarChar(40)
|
||||
lat Float?
|
||||
lng Float?
|
||||
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamptz(6)
|
||||
|
||||
websiteEvent WebsiteEvent[]
|
||||
|
|
@ -57,6 +60,9 @@ model Session {
|
|||
@@index([websiteId, createdAt, country])
|
||||
@@index([websiteId, createdAt, subdivision1])
|
||||
@@index([websiteId, createdAt, city])
|
||||
@@index([websiteId, createdAt, ip])
|
||||
@@index([websiteId, createdAt, lat])
|
||||
@@index([websiteId, createdAt, lng])
|
||||
@@map("session")
|
||||
}
|
||||
|
||||
|
|
@ -147,7 +153,7 @@ 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
|
||||
dataKey String @map("data_key") @db.VarChar(500)
|
||||
dataKey String @map("data_key") @db.VarChar(500)
|
||||
stringValue String? @map("string_value") @db.VarChar(500)
|
||||
numberValue Decimal? @map("number_value") @db.Decimal(19, 4)
|
||||
dateValue DateTime? @map("date_value") @db.Timestamptz(6)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue