forked from wishonia/wishonia
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unique indexes and modify DfdaUserTreatmentReport
Introduced unique constraints on multiple Dfda user report tables to avoid duplicate records. Added a non-null "tried" column to the DfdaUserTreatmentReport table and made "effectiveness" field optional.
- Loading branch information
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
prisma/migrations/20240905165732_unique_dfda_indexes/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,25 @@ | ||
/* | ||
Warnings: | ||
- A unique constraint covering the columns `[userId,conditionId]` on the table `DfdaUserConditionReport` will be added. If there are existing duplicate values, this will fail. | ||
- A unique constraint covering the columns `[userId,sideEffectId,treatmentId]` on the table `DfdaUserSideEffectReport` will be added. If there are existing duplicate values, this will fail. | ||
- A unique constraint covering the columns `[userId,symptomId,conditionId]` on the table `DfdaUserSymptomReport` will be added. If there are existing duplicate values, this will fail. | ||
- A unique constraint covering the columns `[userId,treatmentId,conditionId]` on the table `DfdaUserTreatmentReport` will be added. If there are existing duplicate values, this will fail. | ||
- Added the required column `tried` to the `DfdaUserTreatmentReport` table without a default value. This is not possible if the table is not empty. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "DfdaUserTreatmentReport" ADD COLUMN "tried" BOOLEAN NOT NULL, | ||
ALTER COLUMN "effectiveness" DROP NOT NULL; | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "DfdaUserConditionReport_userId_conditionId_key" ON "DfdaUserConditionReport"("userId", "conditionId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "DfdaUserSideEffectReport_userId_sideEffectId_treatmentId_key" ON "DfdaUserSideEffectReport"("userId", "sideEffectId", "treatmentId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "DfdaUserSymptomReport_userId_symptomId_conditionId_key" ON "DfdaUserSymptomReport"("userId", "symptomId", "conditionId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "DfdaUserTreatmentReport_userId_treatmentId_conditionId_key" ON "DfdaUserTreatmentReport"("userId", "treatmentId", "conditionId"); |
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