-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connect QA to Contracts #2027
Connect QA to Contracts #2027
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
BEGIN; | ||
|
||
ALTER TABLE "Question" ADD COLUMN "contractID" TEXT; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "Question" ADD CONSTRAINT "Question_contractID_fkey" FOREIGN KEY ("contractID") REFERENCES "ContractTable"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- migrate data over | ||
UPDATE "Question" SET "contractID"="pkgID"; | ||
|
||
-- make not nullable, drop pkgID | ||
ALTER TABLE "Question" | ||
ALTER COLUMN "contractID" SET NOT NULL, | ||
DROP CONSTRAINT "Question_pkgID_fkey", | ||
DROP COLUMN "pkgID"; | ||
|
||
COMMIT; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ model HealthPlanPackageTable { | |
stateCode String | ||
state State @relation(fields: [stateCode], references: [stateCode]) | ||
revisions HealthPlanRevisionTable[] | ||
questions Question[] | ||
} | ||
|
||
model ProtoMigrationsTable { | ||
|
@@ -41,9 +40,11 @@ model ContractTable { | |
|
||
mccrsID String? | ||
stateCode String | ||
state State @relation(fields: [stateCode], references: [stateCode]) | ||
state State @relation(fields: [stateCode], references: [stateCode]) | ||
stateNumber Int | ||
|
||
questions Question[] | ||
|
||
revisions ContractRevisionTable[] | ||
// This relationship is a scam. We never call it in our code but Prisma | ||
// requires that there be an inverse to RateRevision.draftContracts which we do use | ||
|
@@ -72,8 +73,8 @@ model ContractRevisionTable { | |
contractID String | ||
contract ContractTable @relation(fields: [contractID], references: [id]) | ||
|
||
rateRevisions RateRevisionsOnContractRevisionsTable[] | ||
draftRates RateTable[] | ||
rateRevisions RateRevisionsOnContractRevisionsTable[] | ||
draftRates RateTable[] | ||
|
||
unlockInfoID String? | ||
unlockInfo UpdateInfoTable? @relation("unlockContractInfo", fields: [unlockInfoID], references: [id]) | ||
|
@@ -130,21 +131,21 @@ model RateRevisionTable { | |
submitInfoID String? | ||
submitInfo UpdateInfoTable? @relation("submitRateInfo", fields: [submitInfoID], references: [id], onDelete: Cascade) | ||
|
||
rateType RateType? | ||
rateCapitationType RateCapitationType? | ||
rateDocuments RateDocument[] | ||
supportingDocuments RateSupportingDocument[] | ||
rateDateStart DateTime? @db.Date | ||
rateDateEnd DateTime? @db.Date | ||
rateDateCertified DateTime? @db.Date | ||
amendmentEffectiveDateStart DateTime? @db.Date | ||
amendmentEffectiveDateEnd DateTime? @db.Date | ||
rateProgramIDs String[] | ||
rateCertificationName String? | ||
certifyingActuaryContacts ActuaryContact[] @relation(name: "CertifyingActuaryOnRateRevision") | ||
addtlActuaryContacts ActuaryContact[] @relation(name: "AddtlActuaryOnRateRevision") | ||
actuaryCommunicationPreference ActuaryCommunication? | ||
contractsWithSharedRateRevision ContractTable[] @relation(name: "SharedRateRevisions") | ||
rateType RateType? | ||
rateCapitationType RateCapitationType? | ||
rateDocuments RateDocument[] | ||
supportingDocuments RateSupportingDocument[] | ||
rateDateStart DateTime? @db.Date | ||
rateDateEnd DateTime? @db.Date | ||
rateDateCertified DateTime? @db.Date | ||
amendmentEffectiveDateStart DateTime? @db.Date | ||
amendmentEffectiveDateEnd DateTime? @db.Date | ||
rateProgramIDs String[] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm maybe we need to build in prisma formatting into our precommit scripts. I've been noticing these kind of formatting difff on our prisma PRs over the last few months |
||
rateCertificationName String? | ||
certifyingActuaryContacts ActuaryContact[] @relation(name: "CertifyingActuaryOnRateRevision") | ||
addtlActuaryContacts ActuaryContact[] @relation(name: "AddtlActuaryOnRateRevision") | ||
actuaryCommunicationPreference ActuaryCommunication? | ||
contractsWithSharedRateRevision ContractTable[] @relation(name: "SharedRateRevisions") | ||
} | ||
|
||
model RateRevisionsOnContractRevisionsTable { | ||
|
@@ -291,12 +292,12 @@ model UserAudit { | |
} | ||
|
||
model Question { | ||
id String @id @default(uuid()) | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @default(now()) @updatedAt | ||
pkgID String | ||
pkg HealthPlanPackageTable @relation(fields: [pkgID], references: [id]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With these changes to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Take a closer look at that migration! All the Questions that were associated with HPP should now be associated with Contracts |
||
addedBy User @relation(fields: [addedByUserID], references: [id]) | ||
id String @id @default(uuid()) | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @default(now()) @updatedAt | ||
contractID String | ||
contract ContractTable @relation(fields: [contractID], references: [id]) | ||
addedBy User @relation(fields: [addedByUserID], references: [id]) | ||
addedByUserID String | ||
division Division | ||
documents QuestionDocument[] | ||
|
@@ -327,10 +328,10 @@ model QuestionResponse { | |
id String @id @default(uuid()) | ||
createdAt DateTime @default(now()) | ||
updatedAt DateTime @updatedAt | ||
question Question @relation(fields: [questionID], references: [id]) | ||
addedBy User @relation(fields: [addedByUserID], references: [id]) | ||
questionID String | ||
question Question @relation(fields: [questionID], references: [id]) | ||
addedByUserID String | ||
addedBy User @relation(fields: [addedByUserID], references: [id]) | ||
documents QuestionResponseDocument[] | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export { findAllQuestionsByHealthPlanPackage } from './findAllQuestionsByHealthPlanPackage' | ||
export { findAllQuestionsByContract } from './findAllQuestionsByContract' | ||
export { insertQuestion } from './insertQuestion' | ||
export { convertToIndexQuestionsPayload } from './questionHelpers' | ||
export { insertQuestionResponse } from './insertQuestionResponse' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where we copy all the pkgIDs into contractIDs
The way this works is that we don't add the NOT NULL constraint until after we copy this over.
then we can safely drop the pkgID column