</actions>
</permacrud>
</class>
+ <class id="aouct" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::org_unit_custom_tree" oils_persist:tablename="actor.org_unit_custom_tree" reporter:label="Org Unit Custom Tree">
+ <fields oils_persist:primary="id" oils_persist:sequence="actor.org_unit_custom_tree_id_seq">
+ <field reporter:label="ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="Active" name="active" reporter:datatype="bool"/>
+ <field reporter:label="Purpose" name="purpose" reporter:datatype="text"/>
+ </fields>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="ADMIN_ORG_UNIT_CUSTOM_TREE" global_required="true" />
+ <retrieve/>
+ <update permission="ADMIN_ORG_UNIT_CUSTOM_TREE" global_required="true" />
+ <delete permission="ADMIN_ORG_UNIT_CUSTOM_TREE" global_required="true" />
+ </actions>
+ </permacrud>
+ </class>
+ <class id="aouctn" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="actor::org_unit_custom_tree_node" oils_persist:tablename="actor.org_unit_custom_tree_node" reporter:label="Org Unit Custom Tree Node">
+ <fields oils_persist:primary="id" oils_persist:sequence="actor.org_unit_custom_tree_node_id_seq">
+ <field reporter:label="ID" name="id" reporter:datatype="id"/>
+ <field reporter:label="Tree" name="tree" reporter:datatype="link"/>
+ <field reporter:label="Org Unit" name="org_unit" reporter:datatype="link"/>
+ <field reporter:label="Parent" name="parent_node" reporter:datatype="link"/>
+ <field reporter:label="Sibling Sort Order" name="sibling_order" reporter:datatype="int"/>
+ <field reporter:label="Children" name="children" reporter:datatype="link" oils_persist:virtual="true" />
+ </fields>
+ <links>
+ <link field="tree" reltype="has_a" key="id" map="" class="aouct"/>
+ <link field="org_unit" reltype="has_a" key="id" map="" class="aou"/>
+ <link field="parent_node" reltype="has_a" key="id" map="" class="aouctn"/>
+ <link field="children" reltype="has_many" key="parent_node" map="" class="aouctn"/>
+ </links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="ADMIN_ORG_UNIT_CUSTOM_TREE" global_required="true" />
+ <retrieve/>
+ <update permission="ADMIN_ORG_UNIT_CUSTOM_TREE" global_required="true" />
+ <delete permission="ADMIN_ORG_UNIT_CUSTOM_TREE" global_required="true" />
+ </actions>
+ </permacrud>
+ </class>
<class id="ccnb" controller="open-ils.cstore" oils_obj:fieldmapper="container::call_number_bucket" oils_persist:tablename="container.call_number_bucket" reporter:label="Call Number Bucket">
<fields oils_persist:primary="id" oils_persist:sequence="container.call_number_bucket_id_seq">
<field name="items" oils_persist:virtual="true" reporter:datatype="link"/>
CREATE UNIQUE INDEX label_once_per_org ON actor.toolbar (org, label) WHERE org IS NOT NULL;
CREATE UNIQUE INDEX label_once_per_usr ON actor.toolbar (usr, label) WHERE usr IS NOT NULL;
+CREATE TYPE actor.org_unit_custom_tree_purpose AS ENUM ('opac');
+CREATE TABLE actor.org_unit_custom_tree (
+ id SERIAL PRIMARY KEY,
+ active BOOLEAN DEFAULT FALSE,
+ purpose actor.org_unit_custom_tree_purpose NOT NULL DEFAULT 'opac' UNIQUE
+);
+
+CREATE TABLE actor.org_unit_custom_tree_node (
+ id SERIAL PRIMARY KEY,
+ tree INTEGER REFERENCES actor.org_unit_custom_tree (id) DEFERRABLE INITIALLY DEFERRED,
+ org_unit INTEGER NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
+ parent_node INTEGER REFERENCES actor.org_unit_custom_tree_node (id) DEFERRABLE INITIALLY DEFERRED,
+ sibling_order INTEGER NOT NULL DEFAULT 0,
+ CONSTRAINT aouctn_once_per_org UNIQUE (tree, org_unit)
+);
+
COMMIT;
)
);
+CREATE TYPE actor.org_unit_custom_tree_purpose AS ENUM ('opac');
+
+CREATE TABLE actor.org_unit_custom_tree (
+ id SERIAL PRIMARY KEY,
+ active BOOLEAN DEFAULT FALSE,
+ purpose actor.org_unit_custom_tree_purpose NOT NULL DEFAULT 'opac' UNIQUE
+);
+
+CREATE TABLE actor.org_unit_custom_tree_node (
+ id SERIAL PRIMARY KEY,
+ tree INTEGER REFERENCES actor.org_unit_custom_tree (id) DEFERRABLE INITIALLY DEFERRED,
+ org_unit INTEGER NOT NULL REFERENCES actor.org_unit (id) DEFERRABLE INITIALLY DEFERRED,
+ parent_node INTEGER REFERENCES actor.org_unit_custom_tree_node (id) DEFERRABLE INITIALLY DEFERRED,
+ sibling_order INTEGER NOT NULL DEFAULT 0,
+ CONSTRAINT aouctn_once_per_org UNIQUE (tree, org_unit)
+);
+
+
COMMIT;
/* UNDO
BEGIN;
DELETE FROM config.global_flag WHERE name = 'opac.org_unit.non_inheritied_visibility';
+DROP TABLE actor.org_unit_custom_tree_node;
+DROP TABLE actor.org_unit_custom_tree;
+DROP TYPE actor.org_unit_custom_tree_purpose;
COMMIT;
*/