From e80b4ffcae1826c3ebef095d74d7a6953f02679b Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Sat, 14 Dec 2024 16:06:26 -0800 Subject: [PATCH] Fixed MySQL. --- db/mysql/schema.prisma | 15 ++++++++------- db/postgresql/schema.prisma | 2 +- src/lib/prisma.ts | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/db/mysql/schema.prisma b/db/mysql/schema.prisma index 5f9d4dff59..476e445f39 100644 --- a/db/mysql/schema.prisma +++ b/db/mysql/schema.prisma @@ -1,5 +1,6 @@ generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" + binaryTargets = ["native", "linux-musl-openssl-3.0.x", "linux-musl-arm64-openssl-3.0.x"] } datasource db { @@ -19,10 +20,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") } @@ -176,8 +177,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") diff --git a/db/postgresql/schema.prisma b/db/postgresql/schema.prisma index 504f70e505..b95e4c52b8 100644 --- a/db/postgresql/schema.prisma +++ b/db/postgresql/schema.prisma @@ -1,6 +1,6 @@ generator client { provider = "prisma-client-js" - binaryTargets = ["native", "linux-musl-openssl-3.0.x"] + binaryTargets = ["native", "linux-musl-openssl-3.0.x", "linux-musl-arm64-openssl-3.0.x"] } datasource db { diff --git a/src/lib/prisma.ts b/src/lib/prisma.ts index a8f7eb0633..735984dba2 100644 --- a/src/lib/prisma.ts +++ b/src/lib/prisma.ts @@ -75,7 +75,7 @@ function getDateSQL(field: string, unit: string, timezone?: string): string { if (db === MYSQL) { if (timezone) { - const tz = formatInTimeZone(new Date(), timezone, 'yyyy-MM-dd HH:mm:ss'); + const tz = formatInTimeZone(new Date(), timezone, 'xxx'); return `date_format(convert_tz(${field},'+00:00','${tz}'), '${MYSQL_DATE_FORMATS[unit]}')`; } return `date_format(${field}, '${MYSQL_DATE_FORMATS[unit]}')`; @@ -90,7 +90,7 @@ function getDateWeeklySQL(field: string, timezone?: string) { } if (db === MYSQL) { - const tz = formatInTimeZone(new Date(), timezone, 'yyyy-MM-dd HH:mm:ss'); + const tz = formatInTimeZone(new Date(), timezone, 'xxx'); return `date_format(convert_tz(${field},'+00:00','${tz}'), '%w:%H')`; } }