diff --git a/ccm-cms/sql/ccm-cms/default/upgrade/6.6.2-6.6.3/create_orgaunit_hierarchy_table.sql b/ccm-cms/sql/ccm-cms/default/upgrade/6.6.2-6.6.3/create_orgaunit_hierarchy_table.sql new file mode 100644 index 000000000..bac9d493b --- /dev/null +++ b/ccm-cms/sql/ccm-cms/default/upgrade/6.6.2-6.6.3/create_orgaunit_hierarchy_table.sql @@ -0,0 +1,42 @@ +-- +-- Copyright (C) 2011 Jens Pelzetter All Rights Reserved. +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License +-- as published by the Free Software Foundation; either version 2.1 of +-- the License, or (at your option) any later version. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- $Id: upd_table_persons.sql pboy $ + +-- This update is only applicable for the internal development tree at +-- University of Bremen ! Don't use for the APLAWS main trunk on +-- fedorahosted! + +CREATE TABLE cms_organizationalunits_hierarchy_map ( + superior_orgaunit_id integer NOT NULL, + subordinate_orgaunit_id integer NOT NULL, + assoc_type character varying(128), + superior_orgaunit_order integer, + subordinate_orgaunit_order integer +); + +-- No sure how to get db owner here +-- ALTER TABLE public.cms_organizationalunits_hierarchy_map OWNER TO iaw; + +ALTER TABLE ONLY cms_organizationalunits_hierarchy_map + ADD CONSTRAINT cms_org_hie_map_sub_or_p_nykpq PRIMARY KEY (subordinate_orgaunit_id, superior_orgaunit_id); + +ALTER TABLE ONLY cms_organizationalunits_hierarchy_map + ADD CONSTRAINT cms_org_hie_map_sub_or_f_xq5is FOREIGN KEY (subordinate_orgaunit_id) REFERENCES cms_organizationalunits(organizationalunit_id); + +ALTER TABLE ONLY cms_organizationalunits_hierarchy_map + ADD CONSTRAINT cms_org_hie_map_sup_or_f_qchkn FOREIGN KEY (superior_orgaunit_id) REFERENCES cms_organizationalunits(organizationalunit_id); \ No newline at end of file