def upgrade(tool): portal = aq_parent(aq_inner(tool)) setup = portal.portal_setup ut = UpgradeUtils(portal) ver_from = ut.getInstalledVersion(product) if ut.isOlderVersion(product, version): logger.info("Skipping upgrade of {0}: {1} > {2}".format( product, ver_from, version)) # The currently installed version is more recent than the target # version of this upgradestep return True logger.info("Upgrading {0}: {1} -> {2}".format(product, ver_from, version)) # The assignment of the whole Calculation object in a metadata column # was causing a "TypeError: Can't pickle objects in acquisition wrappers". # getCalculation was only used in analyses listing and can be safely # replaced by getCalculationUID, cause is only used to determine if a # calculation is required to compute the result value # https://github.com/senaite/bika.lims/issues/322 ut.delColumn(CATALOG_ANALYSIS_LISTING, 'getCalculation') ut.addColumn(CATALOG_ANALYSIS_LISTING, 'getCalculationUID') ut.refreshCatalogs() logger.info("{0} upgraded to version {1}".format(product, version)) return True
def upgrade(tool): portal = tool.aq_inner.aq_parent ut = UpgradeUtils(portal) ver_from = ut.getInstalledVersion(product) if ut.isOlderVersion(product, version): logger.info("Skipping upgrade of {0}: {1} > {2}".format( product, ver_from, version)) return True logger.info("Upgrading {0}: {1} -> {2}".format(product, ver_from, version)) # -------- ADD YOUR STUFF HERE -------- ut.delIndexAndColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatient') ut.delIndexAndColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getDoctor') ut.addColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatientID') ut.addIndexAndColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatientTitle', 'FieldIndex') # In case if upgrade was already run after PR #72 got accepted ut.delColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatientURL') ut.addColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatientURL') ut.addColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getClientPatientID') ut.addIndexAndColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getDoctorTitle', 'FieldIndex') # In case if upgrade was already run after PR #72 got accepted ut.delColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getDoctorURL') ut.addColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getDoctorURL') ut.addIndex(CATALOG_PATIENTS, 'listing_searchable_text', 'TextIndexNG3') ut.refreshCatalogs() logger.info("{0} upgraded to version {1}".format(product, version)) return True
def upgrade(tool): portal = tool.aq_inner.aq_parent setup = portal.portal_setup ut = UpgradeUtils(portal) ver_from = ut.getInstalledVersion(product) if ut.isOlderVersion(product, version): logger.info("Skipping upgrade of {0}: {1} > {2}".format( product, ver_from, version)) # The currently installed version is more recent than the target # version of this upgradestep return True logger.info("Upgrading {0}: {1} -> {2}".format(product, ver_from, version)) # Convert ReferenceField's values into UIDReferenceFields. UpgradeReferenceFields() # Calculations not triggered in manage results view # https://github.com/senaite/bika.lims/issues/355 # Since we've already migrated the ReferenceField DependentServices from # Calculation (with relation name 'CalculationAnalysisService' above, this # wouldn't be strictly necessary, but who knows... maybe we've lost the # at_references too, so just do it. fix_broken_calculations() # Backward compatibility with < 1.0.0 RemoveARPriorities(portal) RemoveVersionableTypes() handle_AS_wo_category(portal) migrateFileFields(portal) # Indexes and colums were changed as per # https://github.com/senaite/bika.lims/pull/353 ut.delIndex(CATALOG_ANALYSIS_LISTING, 'getAnalysisRequestUID') ut.addIndex(CATALOG_ANALYSIS_LISTING, 'getRequestUID', 'FieldIndex') ut.delColumn(CATALOG_ANALYSIS_LISTING, 'getAnalysisRequestURL') ut.delColumn(CATALOG_ANALYSIS_LISTING, 'getAnalysisRequestTitle') ut.addColumn(CATALOG_ANALYSIS_LISTING, 'getRequestURL') ut.addColumn(CATALOG_ANALYSIS_LISTING, 'getRequestTitle') ut.reindexIndex(CATALOG_ANALYSIS_LISTING, 'getPrioritySortkey') ut.refreshCatalogs() return True