From 28a88759c613126e31e356b8402de03b0d858254 Mon Sep 17 00:00:00 2001 From: Balu Babu Date: Wed, 25 Oct 2023 19:38:06 +0530 Subject: [PATCH] feat: added new property to existing shortcode model in prisma schema --- docker-compose.yml | 4 ++-- .../20231025133719_shared_requests/migration.sql | 5 +++++ packages/hoppscotch-backend/prisma/schema.prisma | 12 ++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 packages/hoppscotch-backend/prisma/migrations/20231025133719_shared_requests/migration.sql 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/20231025133719_shared_requests/migration.sql b/packages/hoppscotch-backend/prisma/migrations/20231025133719_shared_requests/migration.sql new file mode 100644 index 000000000..e2300acfe --- /dev/null +++ b/packages/hoppscotch-backend/prisma/migrations/20231025133719_shared_requests/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable +ALTER TABLE "Shortcode" ADD COLUMN "properties" JSONB; + +-- AddForeignKey +ALTER TABLE "Shortcode" ADD CONSTRAINT "Shortcode_creatorUid_fkey" FOREIGN KEY ("creatorUid") REFERENCES "User"("uid") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/packages/hoppscotch-backend/prisma/schema.prisma b/packages/hoppscotch-backend/prisma/schema.prisma index 67feb1ff3..3a2bed07e 100644 --- a/packages/hoppscotch-backend/prisma/schema.prisma +++ b/packages/hoppscotch-backend/prisma/schema.prisma @@ -67,10 +67,21 @@ model TeamRequest { updatedOn DateTime @updatedAt @db.Timestamp(3) } +// model Shortcode { +// id String @id +// request Json +// creatorUid String? +// createdOn DateTime @default(now()) + +// @@unique(fields: [id, creatorUid], name: "creator_uid_shortcode_unique") +// } + model Shortcode { id String @id request Json + properties Json? // if properties is null, SharedRequest is an embed else shortcode creatorUid String? + User User? @relation(fields: [creatorUid], references: [uid]) createdOn DateTime @default(now()) @@unique(fields: [id, creatorUid], name: "creator_uid_shortcode_unique") @@ -102,6 +113,7 @@ model User { currentGQLSession Json? createdOn DateTime @default(now()) @db.Timestamp(3) invitedUsers InvitedUsers[] + shortcodes Shortcode[] } model Account {