Created
November 18, 2020 21:40
-
-
Save chrissharp123/627139c08178e2b045d8645d448e7aa2 to your computer and use it in GitHub Desktop.
SQL used to generate carousels for PINES along with the Evergreen 3.4.1 upgrade in January 2020
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
-- add admin perms to GlobalAdmins | |
insert into permission.grp_perm_map (grp, perm, depth) values ((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_CAROUSEL_TYPE'), 0); | |
insert into permission.grp_perm_map (grp, perm, depth) values ((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'ADMIN_CAROUSEL'), 0); | |
insert into permission.grp_perm_map (grp, perm, depth) values ((select id from permission.grp_tree where name = 'GlobalAdmin'), (select id from permission.perm_list where code = 'REFRESH_CAROUSEL'), 0); | |
commit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment