From 364381f017fd6ad3c8c6f3f8848a4b5c44f3b539 Mon Sep 17 00:00:00 2001 From: Balu Babu Date: Thu, 19 Jan 2023 05:13:21 +0530 Subject: [PATCH] chore: changed the schema of database to only store timestamp without timezone info --- .../migrations/20230118233921_timestamp_fix/migration.sql | 8 ++++++++ packages/hoppscotch-backend/prisma/schema.prisma | 6 +++--- packages/hoppscotch-backend/src/user/user.resolver.ts | 2 -- 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 packages/hoppscotch-backend/prisma/migrations/20230118233921_timestamp_fix/migration.sql diff --git a/packages/hoppscotch-backend/prisma/migrations/20230118233921_timestamp_fix/migration.sql b/packages/hoppscotch-backend/prisma/migrations/20230118233921_timestamp_fix/migration.sql new file mode 100644 index 000000000..e30bff27c --- /dev/null +++ b/packages/hoppscotch-backend/prisma/migrations/20230118233921_timestamp_fix/migration.sql @@ -0,0 +1,8 @@ +-- AlterTable +ALTER TABLE "Account" ALTER COLUMN "loggedIn" SET DATA TYPE TIMESTAMP(3); + +-- AlterTable +ALTER TABLE "PasswordlessVerification" ALTER COLUMN "expiresOn" SET DATA TYPE TIMESTAMP(3); + +-- AlterTable +ALTER TABLE "User" ALTER COLUMN "createdOn" SET DATA TYPE TIMESTAMP(3); diff --git a/packages/hoppscotch-backend/prisma/schema.prisma b/packages/hoppscotch-backend/prisma/schema.prisma index cc22f509e..ea4c57887 100644 --- a/packages/hoppscotch-backend/prisma/schema.prisma +++ b/packages/hoppscotch-backend/prisma/schema.prisma @@ -86,7 +86,7 @@ model User { isAdmin Boolean @default(false) refreshToken String? accounts Account[] - createdOn DateTime @default(now()) @db.Timestamptz(3) + createdOn DateTime @default(now()) @db.Timestamp(3) PasswordlessVerification PasswordlessVerification[] } @@ -98,7 +98,7 @@ model Account { providerRefreshToken String? providerAccessToken String? providerScope String? - loggedIn DateTime @default(now()) @db.Timestamptz(3) + loggedIn DateTime @default(now()) @db.Timestamp(3) user User @relation(fields: [userId], references: [id], onDelete: Cascade) @@ -110,7 +110,7 @@ model PasswordlessVerification { token String @unique @default(cuid()) userUid String user User @relation(fields: [userUid], references: [id], onDelete: Cascade) - expiresOn DateTime @db.Timestamptz(3) + expiresOn DateTime @db.Timestamp(3) @@unique(fields: [deviceIdentifier, token], name: "passwordless_deviceIdentifier_tokens") } diff --git a/packages/hoppscotch-backend/src/user/user.resolver.ts b/packages/hoppscotch-backend/src/user/user.resolver.ts index 5cca6494a..ae1837b0b 100644 --- a/packages/hoppscotch-backend/src/user/user.resolver.ts +++ b/packages/hoppscotch-backend/src/user/user.resolver.ts @@ -6,8 +6,6 @@ import { GqlUser } from '../decorators/gql-user.decorator'; @Resolver(() => User) export class UserResolver { - // TODO: remove the eslint-disable line below once dependencies are added to user.service file - // eslint-disable-next-line @typescript-eslint/no-empty-function constructor() {} @Query(() => User, {