--- /dev/null
+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;
+