adding post-3.4 upgrade script
authorChris Sharp <csharp@georgialibraries.org>
Fri, 22 Nov 2019 16:16:05 +0000 (11:16 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Fri, 22 Nov 2019 16:16:05 +0000 (11:16 -0500)
Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.4-upgrade.sql [new file with mode: 0644]

diff --git a/Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.4-upgrade.sql b/Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.4-upgrade.sql
new file mode 100644 (file)
index 0000000..709dd4c
--- /dev/null
@@ -0,0 +1,17 @@
+begin;
+
+-- Create carousel data for all PINES libraries
+
+-- create carousel for consortium
+insert into container.carousel (type, owner, name, creator, editor, age_filter, owning_lib_filter, max_items) select 5, id, 'New Items at PINES Libraries across Georgia', 1, 1, '1 mon', (select array(select id from actor.org_unit_descendants(id))), 50 from actor.org_unit where id = 1;
+-- create carousels for each library/system
+insert into container.carousel (type, owner, name, creator, editor, age_filter, owning_lib_filter, max_items) select 5, id, 'New Items at ' || name, 1, 1, '6 mons', (select array(select id from actor.org_unit_descendants(id))), 50 from actor.org_unit where id <> 1 and opac_visible;
+-- map the carousels to their units so they display
+insert into container.carousel_org_unit (carousel, org_unit, seq) select id, owner, 0 from container.carousel;
+-- create buckets for each carousel
+insert into container.biblio_record_entry_bucket (owner, name, btype, pub, owning_lib) select 1, 'PINES-Created Bucket for carousel: ' || id, 'carousel', true, owner from container.carousel;
+-- link the carousels to their buckets
+update container.carousel cc set bucket = (select id from container.biblio_record_entry_bucket b where b.owning_lib = cc.owner and b.btype = 'carousel');
+
+commit;
+