From 7b519b152fb6f7f32601d58ef4bcc1ee9711313c Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Tue, 28 Nov 2023 00:45:13 +0800 Subject: [PATCH] feat: add ip record in telemetry --- .../20231127154808_add_telemetry_session_ip/migration.sql | 2 ++ prisma/schema.prisma | 1 + src/server/model/telemetry.ts | 1 + 3 files changed, 4 insertions(+) create mode 100644 prisma/migrations/20231127154808_add_telemetry_session_ip/migration.sql diff --git a/prisma/migrations/20231127154808_add_telemetry_session_ip/migration.sql b/prisma/migrations/20231127154808_add_telemetry_session_ip/migration.sql new file mode 100644 index 0000000..86ca4de --- /dev/null +++ b/prisma/migrations/20231127154808_add_telemetry_session_ip/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "TelemetrySession" ADD COLUMN "ip" VARCHAR(45); diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 94e26f7..7819e16 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -187,6 +187,7 @@ model TelemetrySession { hostname String? @db.VarChar(100) browser String? @db.VarChar(20) os String? @db.VarChar(20) + ip String? @db.VarChar(45) country String? @db.Char(2) subdivision1 String? @db.VarChar(20) subdivision2 String? @db.VarChar(50) diff --git a/src/server/model/telemetry.ts b/src/server/model/telemetry.ts index b59560d..e65fdad 100644 --- a/src/server/model/telemetry.ts +++ b/src/server/model/telemetry.ts @@ -94,6 +94,7 @@ async function findSession(req: Request, url: string) { hostname, browser, os, + ip, country, subdivision1, subdivision2,