// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
// SPDX-License-Identifier: Apache-2.0
import type { PoolClient } from 'pg';
import { prepareCustomMigrationJobData, runCustomMigration } from '../../workers/post-deploy-migration';
import * as fns from '../migrate-functions';
import type { MigrationActionResult } from '../types';
import type { CustomPostDeployMigration } from './types';
export const migration: CustomPostDeployMigration = {
type: 'custom',
prepareJobData: (asyncJob) => prepareCustomMigrationJobData(asyncJob),
run: async (repo, job, jobData) => runCustomMigration(repo, job, jobData, callback),
};
// prettier-ignore
async function callback(client: PoolClient, results: MigrationActionResult[]): Promise<void> {
await fns.idempotentCreateIndex(client, results, 'Account___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Account___version_idx" ON "Account" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ActivityDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ActivityDefinition___version_idx" ON "ActivityDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'AdverseEvent___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "AdverseEvent___version_idx" ON "AdverseEvent" ("__version")');
await fns.idempotentCreateIndex(client, results, 'AllergyIntolerance___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "AllergyIntolerance___version_idx" ON "AllergyIntolerance" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Appointment___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Appointment___version_idx" ON "Appointment" ("__version")');
await fns.idempotentCreateIndex(client, results, 'AppointmentResponse___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "AppointmentResponse___version_idx" ON "AppointmentResponse" ("__version")');
await fns.idempotentCreateIndex(client, results, 'AuditEvent___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "AuditEvent___version_idx" ON "AuditEvent" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Basic___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Basic___version_idx" ON "Basic" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Binary___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Binary___version_idx" ON "Binary" ("__version")');
await fns.idempotentCreateIndex(client, results, 'BiologicallyDerivedProduct___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "BiologicallyDerivedProduct___version_idx" ON "BiologicallyDerivedProduct" ("__version")');
await fns.idempotentCreateIndex(client, results, 'BodyStructure___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "BodyStructure___version_idx" ON "BodyStructure" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Bundle___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Bundle___version_idx" ON "Bundle" ("__version")');
await fns.idempotentCreateIndex(client, results, 'CapabilityStatement___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "CapabilityStatement___version_idx" ON "CapabilityStatement" ("__version")');
await fns.idempotentCreateIndex(client, results, 'CarePlan___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "CarePlan___version_idx" ON "CarePlan" ("__version")');
await fns.idempotentCreateIndex(client, results, 'CareTeam___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "CareTeam___version_idx" ON "CareTeam" ("__version")');
await fns.idempotentCreateIndex(client, results, 'CatalogEntry___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "CatalogEntry___version_idx" ON "CatalogEntry" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ChargeItem___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ChargeItem___version_idx" ON "ChargeItem" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ChargeItemDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ChargeItemDefinition___version_idx" ON "ChargeItemDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Claim___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Claim___version_idx" ON "Claim" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ClaimResponse___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ClaimResponse___version_idx" ON "ClaimResponse" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ClinicalImpression___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ClinicalImpression___version_idx" ON "ClinicalImpression" ("__version")');
await fns.idempotentCreateIndex(client, results, 'CodeSystem___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "CodeSystem___version_idx" ON "CodeSystem" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Communication___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Communication___version_idx" ON "Communication" ("__version")');
await fns.idempotentCreateIndex(client, results, 'CommunicationRequest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "CommunicationRequest___version_idx" ON "CommunicationRequest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'CompartmentDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "CompartmentDefinition___version_idx" ON "CompartmentDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Composition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Composition___version_idx" ON "Composition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ConceptMap___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ConceptMap___version_idx" ON "ConceptMap" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Condition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Condition___version_idx" ON "Condition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Consent___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Consent___version_idx" ON "Consent" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Contract___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Contract___version_idx" ON "Contract" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Coverage___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Coverage___version_idx" ON "Coverage" ("__version")');
await fns.idempotentCreateIndex(client, results, 'CoverageEligibilityRequest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "CoverageEligibilityRequest___version_idx" ON "CoverageEligibilityRequest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'CoverageEligibilityResponse___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "CoverageEligibilityResponse___version_idx" ON "CoverageEligibilityResponse" ("__version")');
await fns.idempotentCreateIndex(client, results, 'DetectedIssue___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "DetectedIssue___version_idx" ON "DetectedIssue" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Device___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Device___version_idx" ON "Device" ("__version")');
await fns.idempotentCreateIndex(client, results, 'DeviceDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "DeviceDefinition___version_idx" ON "DeviceDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'DeviceMetric___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "DeviceMetric___version_idx" ON "DeviceMetric" ("__version")');
await fns.idempotentCreateIndex(client, results, 'DeviceRequest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "DeviceRequest___version_idx" ON "DeviceRequest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'DeviceUseStatement___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "DeviceUseStatement___version_idx" ON "DeviceUseStatement" ("__version")');
await fns.idempotentCreateIndex(client, results, 'DiagnosticReport___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "DiagnosticReport___version_idx" ON "DiagnosticReport" ("__version")');
await fns.idempotentCreateIndex(client, results, 'DocumentManifest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "DocumentManifest___version_idx" ON "DocumentManifest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'DocumentReference___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "DocumentReference___version_idx" ON "DocumentReference" ("__version")');
await fns.idempotentCreateIndex(client, results, 'EffectEvidenceSynthesis___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "EffectEvidenceSynthesis___version_idx" ON "EffectEvidenceSynthesis" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Encounter___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Encounter___version_idx" ON "Encounter" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Endpoint___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Endpoint___version_idx" ON "Endpoint" ("__version")');
await fns.idempotentCreateIndex(client, results, 'EnrollmentRequest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "EnrollmentRequest___version_idx" ON "EnrollmentRequest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'EnrollmentResponse___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "EnrollmentResponse___version_idx" ON "EnrollmentResponse" ("__version")');
await fns.idempotentCreateIndex(client, results, 'EpisodeOfCare___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "EpisodeOfCare___version_idx" ON "EpisodeOfCare" ("__version")');
await fns.idempotentCreateIndex(client, results, 'EventDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "EventDefinition___version_idx" ON "EventDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Evidence___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Evidence___version_idx" ON "Evidence" ("__version")');
await fns.idempotentCreateIndex(client, results, 'EvidenceVariable___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "EvidenceVariable___version_idx" ON "EvidenceVariable" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ExampleScenario___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ExampleScenario___version_idx" ON "ExampleScenario" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ExplanationOfBenefit___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ExplanationOfBenefit___version_idx" ON "ExplanationOfBenefit" ("__version")');
await fns.idempotentCreateIndex(client, results, 'FamilyMemberHistory___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "FamilyMemberHistory___version_idx" ON "FamilyMemberHistory" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Flag___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Flag___version_idx" ON "Flag" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Goal___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Goal___version_idx" ON "Goal" ("__version")');
await fns.idempotentCreateIndex(client, results, 'GraphDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "GraphDefinition___version_idx" ON "GraphDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Group___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Group___version_idx" ON "Group" ("__version")');
await fns.idempotentCreateIndex(client, results, 'GuidanceResponse___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "GuidanceResponse___version_idx" ON "GuidanceResponse" ("__version")');
await fns.idempotentCreateIndex(client, results, 'HealthcareService___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "HealthcareService___version_idx" ON "HealthcareService" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ImagingStudy___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ImagingStudy___version_idx" ON "ImagingStudy" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Immunization___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Immunization___version_idx" ON "Immunization" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ImmunizationEvaluation___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ImmunizationEvaluation___version_idx" ON "ImmunizationEvaluation" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ImmunizationRecommendation___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ImmunizationRecommendation___version_idx" ON "ImmunizationRecommendation" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ImplementationGuide___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ImplementationGuide___version_idx" ON "ImplementationGuide" ("__version")');
await fns.idempotentCreateIndex(client, results, 'InsurancePlan___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "InsurancePlan___version_idx" ON "InsurancePlan" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Invoice___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Invoice___version_idx" ON "Invoice" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Library___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Library___version_idx" ON "Library" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Linkage___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Linkage___version_idx" ON "Linkage" ("__version")');
await fns.idempotentCreateIndex(client, results, 'List___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "List___version_idx" ON "List" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Location___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Location___version_idx" ON "Location" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Measure___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Measure___version_idx" ON "Measure" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MeasureReport___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MeasureReport___version_idx" ON "MeasureReport" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Media___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Media___version_idx" ON "Media" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Medication___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Medication___version_idx" ON "Medication" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicationAdministration___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicationAdministration___version_idx" ON "MedicationAdministration" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicationDispense___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicationDispense___version_idx" ON "MedicationDispense" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicationKnowledge___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicationKnowledge___version_idx" ON "MedicationKnowledge" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicationRequest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicationRequest___version_idx" ON "MedicationRequest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicationStatement___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicationStatement___version_idx" ON "MedicationStatement" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicinalProduct___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicinalProduct___version_idx" ON "MedicinalProduct" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MPA___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MPA___version_idx" ON "MedicinalProductAuthorization" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MPC___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MPC___version_idx" ON "MedicinalProductContraindication" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicinalProductIndication___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicinalProductIndication___version_idx" ON "MedicinalProductIndication" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicinalProductIngredient___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicinalProductIngredient___version_idx" ON "MedicinalProductIngredient" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicinalProductInteraction___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicinalProductInteraction___version_idx" ON "MedicinalProductInteraction" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicinalProductManufactured___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicinalProductManufactured___version_idx" ON "MedicinalProductManufactured" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MedicinalProductPackaged___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MedicinalProductPackaged___version_idx" ON "MedicinalProductPackaged" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MPP___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MPP___version_idx" ON "MedicinalProductPharmaceutical" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MPUE___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MPUE___version_idx" ON "MedicinalProductUndesirableEffect" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MessageDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MessageDefinition___version_idx" ON "MessageDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MessageHeader___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MessageHeader___version_idx" ON "MessageHeader" ("__version")');
await fns.idempotentCreateIndex(client, results, 'MolecularSequence___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "MolecularSequence___version_idx" ON "MolecularSequence" ("__version")');
await fns.idempotentCreateIndex(client, results, 'NamingSystem___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "NamingSystem___version_idx" ON "NamingSystem" ("__version")');
await fns.idempotentCreateIndex(client, results, 'NutritionOrder___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "NutritionOrder___version_idx" ON "NutritionOrder" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Observation___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Observation___version_idx" ON "Observation" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ObservationDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ObservationDefinition___version_idx" ON "ObservationDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'OperationDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "OperationDefinition___version_idx" ON "OperationDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'OperationOutcome___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "OperationOutcome___version_idx" ON "OperationOutcome" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Organization___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Organization___version_idx" ON "Organization" ("__version")');
await fns.idempotentCreateIndex(client, results, 'OrganizationAffiliation___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "OrganizationAffiliation___version_idx" ON "OrganizationAffiliation" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Parameters___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Parameters___version_idx" ON "Parameters" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Patient___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Patient___version_idx" ON "Patient" ("__version")');
await fns.idempotentCreateIndex(client, results, 'PaymentNotice___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "PaymentNotice___version_idx" ON "PaymentNotice" ("__version")');
await fns.idempotentCreateIndex(client, results, 'PaymentReconciliation___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "PaymentReconciliation___version_idx" ON "PaymentReconciliation" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Person___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Person___version_idx" ON "Person" ("__version")');
await fns.idempotentCreateIndex(client, results, 'PlanDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "PlanDefinition___version_idx" ON "PlanDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Practitioner___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Practitioner___version_idx" ON "Practitioner" ("__version")');
await fns.idempotentCreateIndex(client, results, 'PractitionerRole___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "PractitionerRole___version_idx" ON "PractitionerRole" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Procedure___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Procedure___version_idx" ON "Procedure" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Provenance___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Provenance___version_idx" ON "Provenance" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Questionnaire___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Questionnaire___version_idx" ON "Questionnaire" ("__version")');
await fns.idempotentCreateIndex(client, results, 'QuestionnaireResponse___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "QuestionnaireResponse___version_idx" ON "QuestionnaireResponse" ("__version")');
await fns.idempotentCreateIndex(client, results, 'RelatedPerson___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "RelatedPerson___version_idx" ON "RelatedPerson" ("__version")');
await fns.idempotentCreateIndex(client, results, 'RequestGroup___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "RequestGroup___version_idx" ON "RequestGroup" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ResearchDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ResearchDefinition___version_idx" ON "ResearchDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ResearchElementDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ResearchElementDefinition___version_idx" ON "ResearchElementDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ResearchStudy___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ResearchStudy___version_idx" ON "ResearchStudy" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ResearchSubject___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ResearchSubject___version_idx" ON "ResearchSubject" ("__version")');
await fns.idempotentCreateIndex(client, results, 'RiskAssessment___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "RiskAssessment___version_idx" ON "RiskAssessment" ("__version")');
await fns.idempotentCreateIndex(client, results, 'RiskEvidenceSynthesis___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "RiskEvidenceSynthesis___version_idx" ON "RiskEvidenceSynthesis" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Schedule___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Schedule___version_idx" ON "Schedule" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SearchParameter___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SearchParameter___version_idx" ON "SearchParameter" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ServiceRequest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ServiceRequest___version_idx" ON "ServiceRequest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Slot___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Slot___version_idx" ON "Slot" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Specimen___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Specimen___version_idx" ON "Specimen" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SpecimenDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SpecimenDefinition___version_idx" ON "SpecimenDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'StructureDefinition___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "StructureDefinition___version_idx" ON "StructureDefinition" ("__version")');
await fns.idempotentCreateIndex(client, results, 'StructureMap___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "StructureMap___version_idx" ON "StructureMap" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Subscription___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Subscription___version_idx" ON "Subscription" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SubscriptionStatus___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SubscriptionStatus___version_idx" ON "SubscriptionStatus" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Substance___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Substance___version_idx" ON "Substance" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SubstanceNucleicAcid___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SubstanceNucleicAcid___version_idx" ON "SubstanceNucleicAcid" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SubstancePolymer___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SubstancePolymer___version_idx" ON "SubstancePolymer" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SubstanceProtein___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SubstanceProtein___version_idx" ON "SubstanceProtein" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SubstanceReferenceInformation___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SubstanceReferenceInformation___version_idx" ON "SubstanceReferenceInformation" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SubstanceSourceMaterial___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SubstanceSourceMaterial___version_idx" ON "SubstanceSourceMaterial" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SubstanceSpecification___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SubstanceSpecification___version_idx" ON "SubstanceSpecification" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SupplyDelivery___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SupplyDelivery___version_idx" ON "SupplyDelivery" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SupplyRequest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SupplyRequest___version_idx" ON "SupplyRequest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Task___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Task___version_idx" ON "Task" ("__version")');
await fns.idempotentCreateIndex(client, results, 'TerminologyCapabilities___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "TerminologyCapabilities___version_idx" ON "TerminologyCapabilities" ("__version")');
await fns.idempotentCreateIndex(client, results, 'TestReport___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "TestReport___version_idx" ON "TestReport" ("__version")');
await fns.idempotentCreateIndex(client, results, 'TestScript___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "TestScript___version_idx" ON "TestScript" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ValueSet___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ValueSet___version_idx" ON "ValueSet" ("__version")');
await fns.idempotentCreateIndex(client, results, 'VerificationResult___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "VerificationResult___version_idx" ON "VerificationResult" ("__version")');
await fns.idempotentCreateIndex(client, results, 'VisionPrescription___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "VisionPrescription___version_idx" ON "VisionPrescription" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Project___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Project___version_idx" ON "Project" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ClientApplication___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ClientApplication___version_idx" ON "ClientApplication" ("__version")');
await fns.idempotentCreateIndex(client, results, 'User___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "User___version_idx" ON "User" ("__version")');
await fns.idempotentCreateIndex(client, results, 'ProjectMembership___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "ProjectMembership___version_idx" ON "ProjectMembership" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Bot___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Bot___version_idx" ON "Bot" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Login___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Login___version_idx" ON "Login" ("__version")');
await fns.idempotentCreateIndex(client, results, 'PasswordChangeRequest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "PasswordChangeRequest___version_idx" ON "PasswordChangeRequest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'UserSecurityRequest___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "UserSecurityRequest___version_idx" ON "UserSecurityRequest" ("__version")');
await fns.idempotentCreateIndex(client, results, 'JsonWebKey___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "JsonWebKey___version_idx" ON "JsonWebKey" ("__version")');
await fns.idempotentCreateIndex(client, results, 'AccessPolicy___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "AccessPolicy___version_idx" ON "AccessPolicy" ("__version")');
await fns.idempotentCreateIndex(client, results, 'UserConfiguration___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "UserConfiguration___version_idx" ON "UserConfiguration" ("__version")');
await fns.idempotentCreateIndex(client, results, 'BulkDataExport___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "BulkDataExport___version_idx" ON "BulkDataExport" ("__version")');
await fns.idempotentCreateIndex(client, results, 'SmartAppLaunch___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "SmartAppLaunch___version_idx" ON "SmartAppLaunch" ("__version")');
await fns.idempotentCreateIndex(client, results, 'DomainConfiguration___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "DomainConfiguration___version_idx" ON "DomainConfiguration" ("__version")');
await fns.idempotentCreateIndex(client, results, 'AsyncJob___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "AsyncJob___version_idx" ON "AsyncJob" ("__version")');
await fns.idempotentCreateIndex(client, results, 'Agent___version_idx', 'CREATE INDEX CONCURRENTLY IF NOT EXISTS "Agent___version_idx" ON "Agent" ("__version")');
}