From d219b55fa89e05ceb398d95e7e69580c0c551f3d Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Tue, 4 Jan 2022 21:07:05 -0500 Subject: [PATCH] don't crash on upgrade from 5.35 --- ext/search_kit/CRM/Search/Upgrader.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ext/search_kit/CRM/Search/Upgrader.php b/ext/search_kit/CRM/Search/Upgrader.php index 321ed4cc82..c1a3f55aab 100644 --- a/ext/search_kit/CRM/Search/Upgrader.php +++ b/ext/search_kit/CRM/Search/Upgrader.php @@ -51,6 +51,14 @@ class CRM_Search_Upgrader extends CRM_Search_Upgrader_Base { * @return bool */ public function upgrade_1001(): bool { + // If you upgrade direct from 5.35 to 5.40+ then upgrade_1001 which is + // from 5.36 triggers api4 to use the field that gets added in 5.40. + // So rather than rewrite all these upgrades in straight SQL, let's just + // add the field now, and then upgrade_1005 will be a no-op if upgrading + // from 5.36 or earlier. + $this->ctx->log->info('Applying update 1005 before 1001 to avoid chicken and egg problem.'); + $this->addColumn('civicrm_search_display', 'acl_bypass', "tinyint DEFAULT 0 COMMENT 'Skip permission checks and ACLs when running this display.'"); + $this->ctx->log->info('Applying update 1001 - normalize search display columns.'); $savedSearches = \Civi\Api4\SavedSearch::get(FALSE) ->addWhere('api_params', 'IS NOT NULL') -- 2.25.1