feat: added new property to existing shortcode model in prisma schema

This commit is contained in:
Balu Babu
2023-10-25 19:38:06 +05:30
parent d1c9c3583f
commit 28a88759c6
3 changed files with 19 additions and 2 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

@@ -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;

View File

@@ -67,10 +67,21 @@ model TeamRequest {
updatedOn DateTime @updatedAt @db.Timestamp(3) 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 { model Shortcode {
id String @id id String @id
request Json request Json
properties Json? // if properties is null, SharedRequest is an embed else shortcode
creatorUid String? creatorUid String?
User User? @relation(fields: [creatorUid], references: [uid])
createdOn DateTime @default(now()) createdOn DateTime @default(now())
@@unique(fields: [id, creatorUid], name: "creator_uid_shortcode_unique") @@unique(fields: [id, creatorUid], name: "creator_uid_shortcode_unique")
@@ -102,6 +113,7 @@ model User {
currentGQLSession Json? currentGQLSession Json?
createdOn DateTime @default(now()) @db.Timestamp(3) createdOn DateTime @default(now()) @db.Timestamp(3)
invitedUsers InvitedUsers[] invitedUsers InvitedUsers[]
shortcodes Shortcode[]
} }
model Account { model Account {