-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MCR-4887: add new application settings table (#3093)
* Add New tables and migration * Extend prisma to restrict new table methods * Pass prisma options to extendedPrismaClient
- Loading branch information
1 parent
82d51f4
commit 680d284
Showing
3 changed files
with
166 additions
and
3 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
...i/prisma/migrations/20250122005954_add_application_and_email_settings_table/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,75 @@ | ||
BEGIN; | ||
|
||
-- CreateTable | ||
CREATE TABLE "ApplicationSettings" ( | ||
"id" INTEGER NOT NULL DEFAULT 1, | ||
"emailSettingsId" INTEGER DEFAULT 1, | ||
|
||
CONSTRAINT "ApplicationSettings_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "EmailSettings" ( | ||
"id" INTEGER NOT NULL DEFAULT 1, | ||
"emailSource" TEXT NOT NULL DEFAULT '[email protected]', | ||
"devReviewTeamEmails" TEXT[] DEFAULT ARRAY['[email protected]']::TEXT[], | ||
"cmsReviewHelpEmailAddress" TEXT[] DEFAULT ARRAY['MCOGDMCOActions <[email protected]>']::TEXT[], | ||
"cmsRateHelpEmailAddress" TEXT[] DEFAULT ARRAY['MMCratesetting <[email protected]>']::TEXT[], | ||
"oactEmails" TEXT[] DEFAULT ARRAY['OACT Dev1 <[email protected]>', 'OACT Dev2 <[email protected]>']::TEXT[], | ||
"dmcpReviewEmails" TEXT[] DEFAULT ARRAY['DMCP Review Dev1 <[email protected]>', 'DMCP Review Dev2 <[email protected]>']::TEXT[], | ||
"dmcpSubmissionEmails" TEXT[] DEFAULT ARRAY['DMCP Submission Dev1 <[email protected]>', 'DMCP Submission Dev2 <[email protected]>']::TEXT[], | ||
"dmcoEmails" TEXT[] DEFAULT ARRAY['DMCO Dev1 <[email protected]>', 'DMCO Dev2 <[email protected]>']::TEXT[], | ||
"helpDeskEmail" TEXT[] DEFAULT ARRAY['[email protected]']::TEXT[], | ||
"applicationSettingsId" INTEGER DEFAULT 1, | ||
|
||
CONSTRAINT "EmailSettings_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "ApplicationSettings_emailSettingsId_key" ON "ApplicationSettings"("emailSettingsId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "ApplicationSettings_id_key" ON "ApplicationSettings"("id"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "EmailSettings_applicationSettingsId_key" ON "EmailSettings"("applicationSettingsId"); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "EmailSettings_id_key" ON "EmailSettings"("id"); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "EmailSettings" ADD CONSTRAINT "EmailSettings_applicationSettingsId_fkey" FOREIGN KEY ("applicationSettingsId") REFERENCES "ApplicationSettings"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- Insert Initial Records | ||
INSERT INTO "ApplicationSettings" ("id", "emailSettingsId") | ||
VALUES (1, 1) | ||
ON CONFLICT ("id") DO NOTHING; | ||
|
||
INSERT INTO "EmailSettings" ( | ||
"id", | ||
"emailSource", | ||
"devReviewTeamEmails", | ||
"cmsReviewHelpEmailAddress", | ||
"cmsRateHelpEmailAddress", | ||
"oactEmails", | ||
"dmcpReviewEmails", | ||
"dmcpSubmissionEmails", | ||
"dmcoEmails", | ||
"helpDeskEmail", | ||
"applicationSettingsId" | ||
) VALUES ( | ||
1, | ||
'[email protected]', | ||
ARRAY['[email protected]'], | ||
ARRAY['MCOGDMCOActions <[email protected]>'], | ||
ARRAY['MMCratesetting <[email protected]>'], | ||
ARRAY['OACT Dev1 <[email protected]>', 'OACT Dev2 <[email protected]>'], | ||
ARRAY['DMCP Review Dev1 <[email protected]>', 'DMCP Review Dev2 <[email protected]>'], | ||
ARRAY['DMCP Submission Dev1 <[email protected]>', 'DMCP Submission Dev2 <[email protected]>'], | ||
ARRAY['DMCO Dev1 <[email protected]>', 'DMCO Dev2 <[email protected]>'], | ||
ARRAY['[email protected]'], | ||
1 | ||
) | ||
ON CONFLICT ("id") DO NOTHING; | ||
|
||
COMMIT; |
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 |
---|---|---|
|
@@ -19,6 +19,32 @@ model ProtoMigrationsTable { | |
migrationName String @id | ||
} | ||
|
||
model ApplicationSettings { | ||
id Int @id @default(1) | ||
emailSettings EmailSettings? | ||
emailSettingsId Int? @unique @default(1) | ||
@@unique([id]) | ||
} | ||
|
||
model EmailSettings { | ||
id Int @id @default(1) | ||
emailSource String @default("[email protected]") | ||
devReviewTeamEmails String[] @default(["[email protected]"]) | ||
cmsReviewHelpEmailAddress String[] @default(["MCOGDMCOActions <mc-review-qa+[email protected]>"]) | ||
cmsRateHelpEmailAddress String[] @default(["MMCratesetting <mc-review-qa+[email protected]>"]) | ||
oactEmails String[] @default(["OACT Dev1 <mc-review-qa+[email protected]>","OACT Dev2 <mc-review-qa+[email protected]>"]) | ||
dmcpReviewEmails String[] @default(["DMCP Review Dev1 <mc-review-qa+[email protected]>", "DMCP Review Dev2 <mc-review-qa+[email protected]>"]) | ||
dmcpSubmissionEmails String[] @default(["DMCP Submission Dev1 <mc-review-qa+[email protected]>", "DMCP Submission Dev2 <mc-review-qa+[email protected]>"]) | ||
dmcoEmails String[] @default(["DMCO Dev1 <mc-review-qa+[email protected]>", "DMCO Dev2 <mc-review-qa+[email protected]>"]) | ||
helpDeskEmail String[] @default(["[email protected]"]) | ||
applicationSettings ApplicationSettings? @relation(fields: [applicationSettingsId], references: [id]) | ||
applicationSettingsId Int? @unique @default(1) | ||
@@unique([id]) | ||
} | ||
|
||
model HealthPlanRevisionTable { | ||
id String @id | ||
createdAt DateTime | ||
|
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