From 032164f2635312cf8610540479e9b7d5ae9e88ae Mon Sep 17 00:00:00 2001 From: Balu Babu Date: Mon, 6 Nov 2023 17:52:10 +0530 Subject: [PATCH] chore: fixed issue with updatedOn field in shortcodes model --- docker-compose.yml | 4 ++-- .../migration.sql | 3 +-- packages/hoppscotch-backend/prisma/schema.prisma | 3 +-- packages/hoppscotch-backend/src/shortcode/shortcode.model.ts | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) rename packages/hoppscotch-backend/prisma/migrations/{20231106074926_embeds_addition => 20231106120154_embeds_addition}/migration.sql (72%) diff --git a/docker-compose.yml b/docker-compose.yml index c9d5d6684..8263c7035 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -107,7 +107,7 @@ services: build: dockerfile: packages/hoppscotch-backend/Dockerfile context: . - target: prod + target: dev env_file: - ./.env restart: always @@ -117,7 +117,7 @@ services: - PORT=3000 volumes: # Uncomment the line below when modifying code. Only applicable when using the "dev" target. - # - ./packages/hoppscotch-backend/:/usr/src/app + - ./packages/hoppscotch-backend/:/usr/src/app - /usr/src/app/node_modules/ depends_on: hoppscotch-db: diff --git a/packages/hoppscotch-backend/prisma/migrations/20231106074926_embeds_addition/migration.sql b/packages/hoppscotch-backend/prisma/migrations/20231106120154_embeds_addition/migration.sql similarity index 72% rename from packages/hoppscotch-backend/prisma/migrations/20231106074926_embeds_addition/migration.sql rename to packages/hoppscotch-backend/prisma/migrations/20231106120154_embeds_addition/migration.sql index f6720852b..d545bd4e0 100644 --- a/packages/hoppscotch-backend/prisma/migrations/20231106074926_embeds_addition/migration.sql +++ b/packages/hoppscotch-backend/prisma/migrations/20231106120154_embeds_addition/migration.sql @@ -2,12 +2,11 @@ Warnings: - A unique constraint covering the columns `[id]` on the table `Shortcode` will be added. If there are existing duplicate values, this will fail. - - Added the required column `updatedOn` to the `Shortcode` table without a default value. This is not possible if the table is not empty. */ -- AlterTable ALTER TABLE "Shortcode" ADD COLUMN "embedProperties" JSONB, -ADD COLUMN "updatedOn" TIMESTAMP(3) NOT NULL; +ADD COLUMN "updatedOn" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP; -- CreateIndex CREATE UNIQUE INDEX "Shortcode_id_key" ON "Shortcode"("id"); diff --git a/packages/hoppscotch-backend/prisma/schema.prisma b/packages/hoppscotch-backend/prisma/schema.prisma index 814682e5c..68dfed992 100644 --- a/packages/hoppscotch-backend/prisma/schema.prisma +++ b/packages/hoppscotch-backend/prisma/schema.prisma @@ -74,8 +74,7 @@ model Shortcode { creatorUid String? User User? @relation(fields: [creatorUid], references: [uid]) createdOn DateTime @default(now()) - updatedOn DateTime @updatedAt - + updatedOn DateTime @updatedAt @default(now()) @@unique(fields: [id, creatorUid], name: "creator_uid_shortcode_unique") } diff --git a/packages/hoppscotch-backend/src/shortcode/shortcode.model.ts b/packages/hoppscotch-backend/src/shortcode/shortcode.model.ts index 249a56cf1..47828ff79 100644 --- a/packages/hoppscotch-backend/src/shortcode/shortcode.model.ts +++ b/packages/hoppscotch-backend/src/shortcode/shortcode.model.ts @@ -19,7 +19,7 @@ export class Shortcode { properties: string; @Field({ - description: 'Timestamp of when the SharedRequest was created', + description: 'Timestamp of when the Shortcode was created', }) createdOn: Date; }