From: Dan Scott Date: Sun, 22 Jan 2012 19:29:16 +0000 (-0500) Subject: Fix sorting by pubdate for records migrated to 2.1 X-Git-Tag: sprint4-merge-nov22~4560 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=65f14d095ffa9b95598974d414e084845c271092;p=working%2FEvergreen.git Fix sorting by pubdate for records migrated to 2.1 The 'pubdate' attribute is necessary for sorting by publication date to work correctly. It was not populated in the 2.0-2.1 upgrade script, so populate it now based on the 'date1' attribute. Signed-off-by: Dan Scott Signed-off-by: Michael Peters --- diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.0-2.1-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.0-2.1-upgrade-db.sql index e245c831c0..0d66ddcf77 100644 --- a/Open-ILS/src/sql/Pg/version-upgrade/2.0-2.1-upgrade-db.sql +++ b/Open-ILS/src/sql/Pg/version-upgrade/2.0-2.1-upgrade-db.sql @@ -8927,5 +8927,7 @@ UPDATE metabib.record_attr GROUP BY 1) x WHERE x.record = metabib.record_attr.id; - - +UPDATE metabib.record_attr + SET attrs = attrs || ('pubdate' => (attrs->'date1')) + WHERE defined(attrs, 'pubdate') IS FALSE + AND defined(attrs, 'date1') IS TRUE; diff --git a/Open-ILS/src/sql/Pg/version-upgrade/2.1.1-2.1.2-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/2.1.1-2.1.2-upgrade-db.sql new file mode 100644 index 0000000000..301edd453c --- /dev/null +++ b/Open-ILS/src/sql/Pg/version-upgrade/2.1.1-2.1.2-upgrade-db.sql @@ -0,0 +1,6 @@ +-- Fix sorting by pubdate by ensuring migrated records +-- have a pubdate attribute in metabib.record_attr.attrs +UPDATE metabib.record_attr + SET attrs = attrs || ('pubdate' => (attrs->'date1')) + WHERE defined(attrs, 'pubdate') IS FALSE + AND defined(attrs, 'date1') IS TRUE;