chore: fixed issue with updatedOn field in shortcodes model

This commit is contained in:
Balu Babu
2023-11-06 17:52:10 +05:30
parent 61efaaa248
commit 032164f263
4 changed files with 5 additions and 7 deletions

View File

@@ -107,7 +107,7 @@ services:
build: build:
dockerfile: packages/hoppscotch-backend/Dockerfile dockerfile: packages/hoppscotch-backend/Dockerfile
context: . context: .
target: prod target: dev
env_file: env_file:
- ./.env - ./.env
restart: always restart: always
@@ -117,7 +117,7 @@ services:
- PORT=3000 - PORT=3000
volumes: volumes:
# Uncomment the line below when modifying code. Only applicable when using the "dev" target. # 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/ - /usr/src/app/node_modules/
depends_on: depends_on:
hoppscotch-db: hoppscotch-db:

View File

@@ -2,12 +2,11 @@
Warnings: Warnings:
- A unique constraint covering the columns `[id]` on the table `Shortcode` will be added. If there are existing duplicate values, this will fail. - 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 -- AlterTable
ALTER TABLE "Shortcode" ADD COLUMN "embedProperties" JSONB, 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 -- CreateIndex
CREATE UNIQUE INDEX "Shortcode_id_key" ON "Shortcode"("id"); CREATE UNIQUE INDEX "Shortcode_id_key" ON "Shortcode"("id");

View File

@@ -74,8 +74,7 @@ model Shortcode {
creatorUid String? creatorUid String?
User User? @relation(fields: [creatorUid], references: [uid]) User User? @relation(fields: [creatorUid], references: [uid])
createdOn DateTime @default(now()) createdOn DateTime @default(now())
updatedOn DateTime @updatedAt updatedOn DateTime @updatedAt @default(now())
@@unique(fields: [id, creatorUid], name: "creator_uid_shortcode_unique") @@unique(fields: [id, creatorUid], name: "creator_uid_shortcode_unique")
} }

View File

@@ -19,7 +19,7 @@ export class Shortcode {
properties: string; properties: string;
@Field({ @Field({
description: 'Timestamp of when the SharedRequest was created', description: 'Timestamp of when the Shortcode was created',
}) })
createdOn: Date; createdOn: Date;
} }