diff options
author | Marks Polakovs <marks@markspolakovs.me> | 2023-05-17 14:53:48 +0100 |
---|---|---|
committer | Marks Polakovs <marks@markspolakovs.me> | 2023-05-17 14:58:41 +0100 |
commit | c210066e6da5c38a2589bd4fe30cf536e6469254 (patch) | |
tree | f76df130c7450db898dc364ea3645c8f69aed757 /maintenance/postgres | |
parent | 49d8aac8dc261bbbe5103fd748b438e5222745f5 (diff) | |
download | mediawikicore-c210066e6da5c38a2589bd4fe30cf536e6469254.tar.gz mediawikicore-c210066e6da5c38a2589bd4fe30cf536e6469254.zip |
Improve idempotency of postgres index upgrades
Change DROP INDEX statements to DROP INDEX IF EXISTS, meaning the
upgrade does not fail if they do not already exist (which is the desired
end state anyway).
Bug: T336868
Change-Id: Id073beda84065b067994a7405a78d484346b550d
Diffstat (limited to 'maintenance/postgres')
6 files changed, 8 insertions, 8 deletions
diff --git a/maintenance/postgres/archives/patch-categorylinks-pk.sql b/maintenance/postgres/archives/patch-categorylinks-pk.sql index ec37d7ad11de..b88bb79f425e 100644 --- a/maintenance/postgres/archives/patch-categorylinks-pk.sql +++ b/maintenance/postgres/archives/patch-categorylinks-pk.sql @@ -1,3 +1,3 @@ -DROP INDEX cl_from; +DROP INDEX IF EXISTS cl_from; ALTER TABLE categorylinks ADD PRIMARY KEY (cl_from, cl_to); diff --git a/maintenance/postgres/archives/patch-iwlinks-pk.sql b/maintenance/postgres/archives/patch-iwlinks-pk.sql index 23c6dec2e1c5..68c82b432a80 100644 --- a/maintenance/postgres/archives/patch-iwlinks-pk.sql +++ b/maintenance/postgres/archives/patch-iwlinks-pk.sql @@ -1,6 +1,6 @@ -DROP INDEX iwl_from; -DROP INDEX iwl_prefix_title_from; -DROP INDEX iwl_prefix_from_title; +DROP INDEX IF EXISTS iwl_from; +DROP INDEX IF EXISTS iwl_prefix_title_from; +DROP INDEX IF EXISTS iwl_prefix_from_title; ALTER TABLE iwlinks ADD PRIMARY KEY (iwl_from, iwl_prefix, iwl_title); diff --git a/maintenance/postgres/archives/patch-l10n_cache-pk.sql b/maintenance/postgres/archives/patch-l10n_cache-pk.sql index 1f8d685fda2e..b94d9d14bb26 100644 --- a/maintenance/postgres/archives/patch-l10n_cache-pk.sql +++ b/maintenance/postgres/archives/patch-l10n_cache-pk.sql @@ -1,3 +1,3 @@ -DROP INDEX l10n_cache_lc_lang_key; +DROP INDEX IF EXISTS l10n_cache_lc_lang_key; ALTER TABLE l10n_cache ADD PRIMARY KEY (lc_lang, lc_key); diff --git a/maintenance/postgres/archives/patch-langlinks-pk.sql b/maintenance/postgres/archives/patch-langlinks-pk.sql index b3a6ea21febd..1a345a5fd5cf 100644 --- a/maintenance/postgres/archives/patch-langlinks-pk.sql +++ b/maintenance/postgres/archives/patch-langlinks-pk.sql @@ -1,3 +1,3 @@ -DROP INDEX langlinks_unique; +DROP INDEX IF EXISTS langlinks_unique; ALTER TABLE langlinks ADD PRIMARY KEY (ll_from,ll_lang); diff --git a/maintenance/postgres/archives/patch-module_deps-pk.sql b/maintenance/postgres/archives/patch-module_deps-pk.sql index 4f4896a6fed3..f269f6f03a58 100644 --- a/maintenance/postgres/archives/patch-module_deps-pk.sql +++ b/maintenance/postgres/archives/patch-module_deps-pk.sql @@ -1,3 +1,3 @@ -DROP INDEX md_module_skin; +DROP INDEX IF EXISTS md_module_skin; ALTER TABLE module_deps ADD PRIMARY KEY (md_module, md_skin); diff --git a/maintenance/postgres/archives/patch-user_properties-pk.sql b/maintenance/postgres/archives/patch-user_properties-pk.sql index 6a616dfdb418..c6085947de08 100644 --- a/maintenance/postgres/archives/patch-user_properties-pk.sql +++ b/maintenance/postgres/archives/patch-user_properties-pk.sql @@ -1,3 +1,3 @@ -DROP INDEX user_properties_user_property; +DROP INDEX IF EXISTS user_properties_user_property; ALTER TABLE user_properties ADD PRIMARY KEY (up_user, up_property); |