wiki.techinc.nl/maintenance/postgres/archives/patch-iwlinks-pk.sql
Marks Polakovs c210066e6d 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
2023-05-17 14:58:41 +01:00

8 lines
354 B
SQL

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);
CREATE INDEX iwl_prefix_title_from ON iwlinks (iwl_prefix, iwl_title, iwl_from);
CREATE INDEX iwl_prefix_from_title ON iwlinks (iwl_prefix, iwl_from, iwl_title);