forked from medplum/medplum
-
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.
Drop unused columns from lookup tables (medplum#4294)
- Loading branch information
1 parent
873f6c1
commit 4306ebc
Showing
3 changed files
with
192 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
/* | ||
* Generated by @medplum/generator | ||
* Do not edit manually. | ||
*/ | ||
|
||
import { PoolClient } from 'pg'; | ||
|
||
const resourceTypes = [ | ||
'AccessPolicy', | ||
'Account', | ||
'ActivityDefinition', | ||
'AdverseEvent', | ||
'Agent', | ||
'AllergyIntolerance', | ||
'Appointment', | ||
'AppointmentResponse', | ||
'AsyncJob', | ||
'AuditEvent', | ||
'Basic', | ||
'Binary', | ||
'BiologicallyDerivedProduct', | ||
'BodyStructure', | ||
'Bot', | ||
'BulkDataExport', | ||
'Bundle', | ||
'CapabilityStatement', | ||
'CarePlan', | ||
'CareTeam', | ||
'CatalogEntry', | ||
'ChargeItem', | ||
'ChargeItemDefinition', | ||
'Claim', | ||
'ClaimResponse', | ||
'ClientApplication', | ||
'ClinicalImpression', | ||
'CodeSystem', | ||
'Communication', | ||
'CommunicationRequest', | ||
'CompartmentDefinition', | ||
'Composition', | ||
'ConceptMap', | ||
'Condition', | ||
'Consent', | ||
'Contract', | ||
'Coverage', | ||
'CoverageEligibilityRequest', | ||
'CoverageEligibilityResponse', | ||
'DetectedIssue', | ||
'Device', | ||
'DeviceDefinition', | ||
'DeviceMetric', | ||
'DeviceRequest', | ||
'DeviceUseStatement', | ||
'DiagnosticReport', | ||
'DocumentManifest', | ||
'DocumentReference', | ||
'DomainConfiguration', | ||
'EffectEvidenceSynthesis', | ||
'Encounter', | ||
'Endpoint', | ||
'EnrollmentRequest', | ||
'EnrollmentResponse', | ||
'EpisodeOfCare', | ||
'EventDefinition', | ||
'Evidence', | ||
'EvidenceVariable', | ||
'ExampleScenario', | ||
'ExplanationOfBenefit', | ||
'FamilyMemberHistory', | ||
'Flag', | ||
'Goal', | ||
'GraphDefinition', | ||
'Group', | ||
'GuidanceResponse', | ||
'HealthcareService', | ||
'ImagingStudy', | ||
'Immunization', | ||
'ImmunizationEvaluation', | ||
'ImmunizationRecommendation', | ||
'ImplementationGuide', | ||
'InsurancePlan', | ||
'Invoice', | ||
'JsonWebKey', | ||
'Library', | ||
'Linkage', | ||
'List', | ||
'Location', | ||
'Login', | ||
'Measure', | ||
'MeasureReport', | ||
'Media', | ||
'Medication', | ||
'MedicationAdministration', | ||
'MedicationDispense', | ||
'MedicationKnowledge', | ||
'MedicationRequest', | ||
'MedicationStatement', | ||
'MedicinalProduct', | ||
'MedicinalProductAuthorization', | ||
'MedicinalProductContraindication', | ||
'MedicinalProductIndication', | ||
'MedicinalProductIngredient', | ||
'MedicinalProductInteraction', | ||
'MedicinalProductManufactured', | ||
'MedicinalProductPackaged', | ||
'MedicinalProductPharmaceutical', | ||
'MedicinalProductUndesirableEffect', | ||
'MessageDefinition', | ||
'MessageHeader', | ||
'MolecularSequence', | ||
'NamingSystem', | ||
'NutritionOrder', | ||
'Observation', | ||
'ObservationDefinition', | ||
'OperationDefinition', | ||
'OperationOutcome', | ||
'Organization', | ||
'OrganizationAffiliation', | ||
'Parameters', | ||
'PasswordChangeRequest', | ||
'Patient', | ||
'PaymentNotice', | ||
'PaymentReconciliation', | ||
'Person', | ||
'PlanDefinition', | ||
'Practitioner', | ||
'PractitionerRole', | ||
'Procedure', | ||
'Project', | ||
'ProjectMembership', | ||
'Provenance', | ||
'Questionnaire', | ||
'QuestionnaireResponse', | ||
'RelatedPerson', | ||
'RequestGroup', | ||
'ResearchDefinition', | ||
'ResearchElementDefinition', | ||
'ResearchStudy', | ||
'ResearchSubject', | ||
'RiskAssessment', | ||
'RiskEvidenceSynthesis', | ||
'Schedule', | ||
'SearchParameter', | ||
'ServiceRequest', | ||
'Slot', | ||
'SmartAppLaunch', | ||
'Specimen', | ||
'SpecimenDefinition', | ||
'StructureDefinition', | ||
'StructureMap', | ||
'Subscription', | ||
'SubscriptionStatus', | ||
'Substance', | ||
'SubstanceNucleicAcid', | ||
'SubstancePolymer', | ||
'SubstanceProtein', | ||
'SubstanceReferenceInformation', | ||
'SubstanceSourceMaterial', | ||
'SubstanceSpecification', | ||
'SupplyDelivery', | ||
'SupplyRequest', | ||
'Task', | ||
'TerminologyCapabilities', | ||
'TestReport', | ||
'TestScript', | ||
'User', | ||
'UserConfiguration', | ||
'ValueSet', | ||
'VerificationResult', | ||
'VisionPrescription', | ||
]; | ||
|
||
export async function run(client: PoolClient): Promise<void> { | ||
await client.query('ALTER TABLE "Address" DROP COLUMN "id"'); | ||
await client.query('ALTER TABLE "Address" DROP COLUMN "index"'); | ||
await client.query('ALTER TABLE "Address" DROP COLUMN "content"'); | ||
|
||
await client.query('ALTER TABLE "HumanName" DROP COLUMN "id"'); | ||
await client.query('ALTER TABLE "HumanName" DROP COLUMN "index"'); | ||
await client.query('ALTER TABLE "HumanName" DROP COLUMN "content"'); | ||
|
||
await client.query('ALTER TABLE "ValueSetElement" DROP COLUMN "id"'); | ||
|
||
for (const resourceType of resourceTypes) { | ||
await client.query(`ALTER TABLE "${resourceType}_Token" DROP COLUMN "index"`); | ||
} | ||
} |