-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added transation in member interaction, feedback, followup
- added migration files
- Loading branch information
1 parent
2285418
commit e742f0a
Showing
9 changed files
with
212 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
apps/web-api/prisma/migrations/20240731093436_member_interaction_follow_up/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
-- CreateEnum | ||
CREATE TYPE "MemberFollowUpStatus" AS ENUM ('PENDING', 'COMPLETED'); | ||
|
||
-- CreateEnum | ||
CREATE TYPE "MemberFeedbackResponseType" AS ENUM ('POSITIVE', 'NEGATIVE', 'NEUTRAL'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "MemberInteraction" ( | ||
"id" SERIAL NOT NULL, | ||
"uid" TEXT NOT NULL, | ||
"type" TEXT NOT NULL, | ||
"data" JSONB, | ||
"hasFollowUp" BOOLEAN NOT NULL DEFAULT false, | ||
"sourceMemberUid" TEXT NOT NULL, | ||
"targetMemberUid" TEXT, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "MemberInteraction_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "MemberFollowUp" ( | ||
"id" SERIAL NOT NULL, | ||
"uid" TEXT NOT NULL, | ||
"status" "MemberFollowUpStatus" NOT NULL, | ||
"type" TEXT NOT NULL, | ||
"data" JSONB, | ||
"isDelayed" BOOLEAN NOT NULL DEFAULT false, | ||
"interactionUid" TEXT, | ||
"createdBy" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "MemberFollowUp_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "MemberFeedback" ( | ||
"id" SERIAL NOT NULL, | ||
"uid" TEXT NOT NULL, | ||
"type" TEXT NOT NULL, | ||
"data" JSONB, | ||
"rating" INTEGER, | ||
"comments" TEXT[], | ||
"response" "MemberFeedbackResponseType" NOT NULL, | ||
"followUpUid" TEXT NOT NULL, | ||
"createdBy" TEXT NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
|
||
CONSTRAINT "MemberFeedback_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "MemberInteraction_uid_key" ON "MemberInteraction"("uid"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "MemberFollowUp_uid_key" ON "MemberFollowUp"("uid"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "MemberFeedback_uid_key" ON "MemberFeedback"("uid"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "MemberFeedback_followUpUid_key" ON "MemberFeedback"("followUpUid"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "MemberInteraction" ADD CONSTRAINT "MemberInteraction_sourceMemberUid_fkey" FOREIGN KEY ("sourceMemberUid") REFERENCES "Member"("uid") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "MemberInteraction" ADD CONSTRAINT "MemberInteraction_targetMemberUid_fkey" FOREIGN KEY ("targetMemberUid") REFERENCES "Member"("uid") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "MemberFollowUp" ADD CONSTRAINT "MemberFollowUp_interactionUid_fkey" FOREIGN KEY ("interactionUid") REFERENCES "MemberInteraction"("uid") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "MemberFollowUp" ADD CONSTRAINT "MemberFollowUp_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "Member"("uid") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "MemberFeedback" ADD CONSTRAINT "MemberFeedback_followUpUid_fkey" FOREIGN KEY ("followUpUid") REFERENCES "MemberFollowUp"("uid") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "MemberFeedback" ADD CONSTRAINT "MemberFeedback_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "Member"("uid") ON DELETE RESTRICT ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters