source: LATMOS-Accounts/sqldata/base.sql @ 863

Last change on this file since 863 was 863, checked in by nanardon, 13 years ago
  • support IPv6 adresses
File size: 77.3 KB
Line 
1--
2-- PostgreSQL database dump
3--
4
5SET statement_timeout = 0;
6SET client_encoding = 'UTF8';
7SET standard_conforming_strings = off;
8SET check_function_bodies = false;
9SET client_min_messages = warning;
10SET escape_string_warning = off;
11
12--
13-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
14--
15
16CREATE PROCEDURAL LANGUAGE plpgsql;
17
18
19SET search_path = public, pg_catalog;
20
21--
22-- Name: accreq_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
23--
24
25CREATE FUNCTION accreq_attr_update_ref() RETURNS trigger
26    LANGUAGE plpgsql
27    AS $$begin
28
29IF (TG_OP != 'INSERT') then
30update "accreq" set date = now() where "accreq".ikey = old.okey;
31end if;
32IF (TG_OP != 'DELETE') then
33update "accreq"  set date = now() where "accreq".ikey = new.okey;
34end if;
35
36IF (TG_OP = 'DELETE') then
37  return old;
38ELSE
39  return new;
40END IF;
41
42END;$$;
43
44
45--
46-- Name: address_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
47--
48
49CREATE FUNCTION address_attr_update_ref() RETURNS trigger
50    LANGUAGE plpgsql
51    AS $$begin
52
53IF (TG_OP != 'INSERT') then
54update "address" set date = now() where "address".ikey = old.okey;
55end if;
56IF (TG_OP != 'DELETE') then
57update "address"  set date = now() where "address".ikey = new.okey;
58end if;
59
60IF (TG_OP = 'DELETE') then
61  return old;
62ELSE
63  return new;
64END IF;
65
66END;$$;
67
68
69--
70-- Name: address_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
71--
72
73CREATE FUNCTION address_sort_fields() RETURNS trigger
74    LANGUAGE plpgsql
75    AS $$BEGIN
76
77IF (TG_OP='INSERT') then
78IF (new.attr='site') THEN
79insert into address_attributes_site VALUES (new.*);
80RETURN NULL;
81END IF;
82
83IF (new.attr = 'isMainAddress') then
84-- remove isMainAddress from other address
85-- for of the user
86delete from address_attributes_base where
87attr = 'isMainAddress' and
88okey in (
89select addr.ikey from address as addr join
90  address on addr.user = address.user
91  where 
92  address.ikey = new.okey and addr.ikey != new.okey
93);
94END IF;
95end if;
96
97if (TG_OP='DELETE') THEN
98RETURN old;
99else
100RETURN new;
101end if;
102END;$$;
103
104
105--
106-- Name: address_update_user_rev(); Type: FUNCTION; Schema: public; Owner: -
107--
108
109CREATE FUNCTION address_update_user_rev() RETURNS trigger
110    LANGUAGE plpgsql
111    AS $$begin
112
113IF (TG_OP = 'DELETE') THEN
114update "user" set "date" = now() where "name" = old."user";
115return old;
116ELSE
117update "user" set "date" = now() where "name" = new."user";
118return new;
119end if;
120
121end;$$;
122
123
124--
125-- Name: aliases_nickname(); Type: FUNCTION; Schema: public; Owner: -
126--
127
128CREATE FUNCTION aliases_nickname() RETURNS trigger
129    LANGUAGE plpgsql
130    AS $$begin
131
132IF TG_OP='DELETE' THEN
133delete from user_attributes where attr='nickname' and value=old.name;
134RETURN old;
135END IF;
136
137IF TG_OP='UPDATE' THEN
138IF new.forward <> old.forward THEN
139delete from user_attributes where attr='nickname' and value=old.name;
140RETURN new;
141END IF;
142END IF;
143
144IF TG_OP='DELETE' then
145return old;
146ELSE
147return new;
148END IF;
149END;$$;
150
151--
152-- Name: department_group_upd_f(); Type: FUNCTION; Schema: public; Owner: -
153--
154
155CREATE FUNCTION department_group_upd_f() RETURNS trigger
156    LANGUAGE plpgsql
157    AS $$BEGIN
158
159IF (new.attr = 'department') then
160  BEGIN
161  insert into group_attributes (okey, attr, value)
162  select "group"."ikey", 'memberUID', "user"."name"
163  from "user", "group"
164  where "group"."name" = new."value" and "user".ikey = new.okey;
165  EXCEPTION WHEN unique_violation THEN
166  END;
167END IF;
168
169RETURN new;
170END;$$;
171
172
173--
174-- Name: fmt_macaddr(); Type: FUNCTION; Schema: public; Owner: -
175--
176
177CREATE FUNCTION fmt_macaddr() RETURNS trigger
178    LANGUAGE plpgsql
179    AS $$begin
180
181new.value := new.value::macaddr::text;
182
183return new;
184end;$$;
185
186
187--
188-- Name: group_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
189--
190
191CREATE FUNCTION group_attr_update_ref() RETURNS trigger
192    LANGUAGE plpgsql
193    AS $$begin
194
195IF (TG_OP != 'INSERT') then
196update "group"  set date = now() where "group"."ikey" = old.okey;
197end if;
198IF (TG_OP != 'DELETE') then
199update "group"  set date = now() where "group"."ikey" = new.okey;
200end if;
201
202IF (TG_OP = 'DELETE') then
203  return old;
204ELSE
205  return new;
206END IF;
207
208END;$$;
209
210
211--
212-- Name: group_attr_user_update_user_ref(); Type: FUNCTION; Schema: public; Owner: -
213--
214
215CREATE FUNCTION group_attr_user_update_user_ref() RETURNS trigger
216    LANGUAGE plpgsql
217    AS $$begin
218
219IF (TG_OP != 'INSERT') then
220update "user"  set date = now() where "user"."name" = old.value;
221end if;
222IF (TG_OP != 'DELETE') then
223update "user"  set date = now() where "user"."name" = new.value;
224end if;
225
226IF (TG_OP = 'DELETE') then
227  return old;
228ELSE
229  return new;
230END IF;
231
232END;$$;
233
234
235--
236-- Name: group_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
237--
238
239CREATE FUNCTION group_sort_fields() RETURNS trigger
240    LANGUAGE plpgsql
241    AS $$BEGIN
242
243IF (TG_OP='INSERT') then
244IF (new.attr='managedBy'
245OR  new.attr='member'
246OR  new.attr='memberUID') THEN
247insert into group_attributes_users VALUES (new.*);
248RETURN NULL;
249END IF;
250
251IF (new.attr='sutype') THEN
252insert into group_attributes_sutypes VALUES (new.*);
253RETURN NULL;
254END IF;
255end if;
256
257
258IF (TG_OP = 'UPDATE') THEN
259IF (new.attr='gidNumber') then
260update "group" set gidnumber = new.value::integer where "group".ikey = new.okey;
261RETURN NULL;
262END IF;
263END IF;
264
265IF (TG_OP = 'DELETE') THEN
266IF (old.attr='exported') then
267update "group" set exported = false where "group".ikey = old.okey;
268return null;
269end if;
270else
271IF (new.attr='exported') then
272update "group" set exported = true where "group".ikey = new.okey;
273RETURN NULL;
274end if;
275END IF;
276
277if (TG_OP='DELETE') THEN
278RETURN old;
279else
280RETURN new;
281end if;
282END;$$;
283
284
285--
286-- Name: nethost_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
287--
288
289CREATE FUNCTION nethost_attr_update_ref() RETURNS trigger
290    LANGUAGE plpgsql
291    AS $$begin
292
293IF (TG_OP != 'INSERT') then
294update "nethost" set date = now() where "nethost".ikey = old.okey;
295end if;
296IF (TG_OP != 'DELETE') then
297update "nethost"  set date = now() where "nethost".ikey = new.okey;
298end if;
299
300IF (TG_OP = 'DELETE') then
301  return old;
302ELSE
303  return new;
304END IF;
305
306END;$$;
307
308
309--
310-- Name: nethost_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
311--
312
313CREATE FUNCTION nethost_sort_fields() RETURNS trigger
314    LANGUAGE plpgsql
315    AS $$BEGIN
316
317IF (TG_OP='INSERT') then
318IF (new.attr='ip') THEN
319insert into nethost_attributes_ips VALUES (new.*);
320RETURN NULL;
321END IF;
322
323IF (new.attr='macaddr') THEN
324insert into nethost_attributes_macs VALUES (new.*);
325RETURN NULL;
326END IF;
327
328IF (new.attr='owner') THEN
329insert into nethost_attributes_users VALUES (new.*);
330RETURN NULL;
331END IF;
332end if;
333
334
335
336if (TG_OP='DELETE') THEN
337RETURN old;
338else
339RETURN new;
340end if;
341END;$$;
342
343
344--
345-- Name: nethost_upd_zone(); Type: FUNCTION; Schema: public; Owner: -
346--
347
348CREATE FUNCTION nethost_upd_zone() RETURNS trigger
349    LANGUAGE plpgsql
350    AS $$begin
351
352  IF (TG_OP = 'DELETE') THEN
353    update netzone set date=now() where ikey in
354    (
355    select okey from netzone_attributes where attr='allow_dyn'
356    union
357    select netzone_attributes.okey from netzone_attributes join
358    nethost_attributes_ips on netzone_attributes.attr='net' and 
359    nethost_attributes_ips.value::inet <<= netzone_attributes.value::inet
360    where nethost_attributes_ips.okey = old.ikey
361    );
362  END IF;
363  IF (TG_OP = 'INSERT' or TG_OP = 'UPDATE') THEN
364    update netzone set date=now() where ikey in
365    (
366    select okey from netzone_attributes where attr='allow_dyn'
367    union
368    select netzone_attributes.okey from netzone_attributes join
369    nethost_attributes_ips on netzone_attributes.attr='net' and 
370    nethost_attributes_ips.value::inet <<= netzone_attributes.value::inet
371    where nethost_attributes_ips.okey = new.ikey
372    );
373  END IF;
374
375 IF (TG_OP = 'DELETE') THEN
376   return old;
377 ELSE
378   return new;
379 END IF;
380
381END;$$;
382
383
384--
385-- Name: nethostipdel_upd_zone(); Type: FUNCTION; Schema: public; Owner: -
386--
387
388CREATE FUNCTION nethostipdel_upd_zone() RETURNS trigger
389    LANGUAGE plpgsql
390    AS $$begin
391
392
393    update netzone set date=now() where ikey in
394    (
395    select okey from netzone_attributes where attr='allow_dyn'
396    union
397    select okey from netzone_attributes where attr='net' and
398    old.value::inet <<= netzone_attributes.value::inet
399    );
400
401   return old;
402 
403END;$$;
404
405
406--
407-- Name: netzone_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
408--
409
410CREATE FUNCTION netzone_attr_update_ref() RETURNS trigger
411    LANGUAGE plpgsql
412    AS $$begin
413
414IF (TG_OP != 'INSERT') then
415update "netzone" set date = now() where "netzone".ikey = old.okey;
416end if;
417IF (TG_OP != 'DELETE') then
418update "netzone"  set date = now() where "netzone".ikey = new.okey;
419end if;
420
421IF (TG_OP = 'DELETE') then
422  return old;
423ELSE
424  return new;
425END IF;
426
427END;$$;
428
429
430--
431-- Name: netzone_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
432--
433
434CREATE FUNCTION netzone_sort_fields() RETURNS trigger
435    LANGUAGE plpgsql
436    AS $$BEGIN
437
438IF (TG_OP='INSERT') then
439IF (new.attr='site') THEN
440insert into netzone_attributes_site VALUES (new.*);
441RETURN NULL;
442END IF;
443
444IF (new.attr='dynFrom') THEN
445insert into netzone_attributes_netzone VALUES (new.*);
446RETURN NULL;
447END IF;
448
449end if;
450
451if (TG_OP='DELETE') THEN
452RETURN old;
453else
454RETURN new;
455end if;
456END;$$;
457
458
459--
460-- Name: person_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
461--
462
463CREATE FUNCTION person_attr_update_ref() RETURNS trigger
464    LANGUAGE plpgsql
465    AS $$begin
466
467IF (TG_OP != 'INSERT') then
468update "user" set date = now() where "user".ikey = old.okey;
469update "group" set date = now() where "group".name = old.value;
470end if;
471IF (TG_OP != 'DELETE') then
472update "user"  set date = now() where "user".ikey = new.okey;
473update "group" set date = now() where "group".name = new.value;
474end if;
475
476IF (TG_OP = 'DELETE') then
477  return old;
478ELSE
479  return new;
480END IF;
481
482END;$$;
483
484
485--
486-- Name: rev_tg_f(); Type: FUNCTION; Schema: public; Owner: -
487--
488
489CREATE FUNCTION rev_tg_f() RETURNS trigger
490    LANGUAGE plpgsql
491    AS $$begin
492
493IF (TG_OP = 'DELETE') THEN
494  update settings set val = old.ikey where varname = 'last-delete';
495  IF NOT FOUND THEN
496    insert into settings (varname, val) values ('last-delete', old.ikey);
497  END IF;
498  return old;
499else
500  IF (TG_OP = 'INSERT') THEN
501  new.rev := nextval('revisions_rev_seq'::regclass);
502  new.date := now();
503  ELSIF (old.rev = new.rev) THEN
504  new.rev := nextval('revisions_rev_seq'::regclass);
505  new.date := now();
506  END IF; 
507  return new;
508END IF;
509
510end;$$;
511
512
513--
514-- Name: site_attr_update_ref(); Type: FUNCTION; Schema: public; Owner: -
515--
516
517CREATE FUNCTION site_attr_update_ref() RETURNS trigger
518    LANGUAGE plpgsql
519    AS $$begin
520
521IF (TG_OP != 'INSERT') then
522update "site" set date = now() where "site".ikey = old.okey;
523end if;
524IF (TG_OP != 'DELETE') then
525update "site"  set date = now() where "site".ikey = new.okey;
526end if;
527
528IF (TG_OP = 'DELETE') then
529  return old;
530ELSE
531  return new;
532END IF;
533
534END;$$;
535
536
537--
538-- Name: update_address_site(); Type: FUNCTION; Schema: public; Owner: -
539--
540
541CREATE FUNCTION update_address_site() RETURNS trigger
542    LANGUAGE plpgsql
543    AS $$begin
544
545IF (TG_OP='DELETE') then
546update address set date = now() where ikey in
547(select okey from address_attributes where attr = 'site' and
548value = old.name);
549return old;
550ELSE
551update address set date = now() where ikey in
552(select okey from address_attributes where attr = 'site' and
553value = new.name);
554return new;
555end if;
556
557end;$$;
558
559
560--
561-- Name: user_sort_fields(); Type: FUNCTION; Schema: public; Owner: -
562--
563
564CREATE FUNCTION user_sort_fields() RETURNS trigger
565    LANGUAGE plpgsql
566    AS $$DECLARE
567  rec RECORD;
568BEGIN
569
570IF (TG_OP='UPDATE' or TG_OP='INSERT') THEN
571
572IF (new.attr='locked') THEN
573  IF (TG_OP = 'INSERT') THEN
574    new.value = now()::text;
575  ELSIF (TG_OP='UPDATE') THEN
576    new.value = old.value;
577  END IF;
578END IF;
579
580IF (new.attr='nickname') THEN
581  PERFORM 1 from "user" where "user".ikey = new.okey
582  and new.value = "user".name;
583  IF NOT FOUND THEN
584    select aliases.name into rec from aliases join "user"
585    on array["user".name] = aliases.forward
586    where "user".ikey = new.okey and aliases.name = new.value;
587    IF NOT FOUND THEN
588      insert into aliases ("name", "forward")
589      select new.value, array["user".name] from "user" where "user".ikey = new.okey;
590    END IF;
591  END IF;
592END IF;
593
594IF (new.attr='uidNumber') THEN
595update "user" set uidnumber = new.value::integer where ikey = new.okey;
596RETURN NULL;
597END IF;
598
599IF (new.attr='gidNumber') THEN
600update "user" set gidnumber = new.value::integer where ikey = new.okey;
601RETURN null;
602END IF;
603
604IF (new.attr='expire') THEN
605update "user" set expire = new.value::timestamp where ikey = new.okey;
606RETURN NULL;
607END IF;
608
609IF (new.attr='exported') THEN
610update "user" set exported = true where ikey = new.okey;
611RETURN NULL;
612END IF;
613
614END IF;
615
616IF (TG_OP = 'DELETE') THEN
617
618IF (old.attr='expire') THEN
619update "user" set expire = NULL where ikey = old.okey;
620RETURN NULL;
621END IF;
622
623IF (old.attr='exported') THEN
624update "user" set exported = false where ikey = old.okey;
625RETURN NULL;
626END IF;
627
628END IF;
629
630
631IF (TG_OP='INSERT') THEN
632IF (new.attr='manager') THEN
633insert into user_attributes_users VALUES (new.*);
634RETURN NULL;
635END IF;
636
637IF (new.attr='site') THEN
638insert into user_attributes_site VALUES (new.*);
639RETURN NULL;
640END IF;
641
642IF (new.attr='department') THEN
643insert into user_attributes_groups VALUES (new.*);
644RETURN NULL;
645END IF;
646
647IF (new.attr='contratType') THEN
648insert into user_attributes_groups VALUES (new.*);
649RETURN NULL;
650END IF;
651
652IF (new.attr='jobType') THEN
653insert into user_attributes_groups VALUES (new.*);
654RETURN NULL;
655END IF;
656
657END IF;
658
659IF (TG_OP='DELETE') then
660RETURN old;
661ELSE
662RETURN new;
663end if;
664END;$$;
665
666
667--
668-- Name: ikey_seq; Type: SEQUENCE; Schema: public; Owner: -
669--
670
671CREATE SEQUENCE ikey_seq
672    START WITH 1
673    INCREMENT BY 1
674    NO MAXVALUE
675    NO MINVALUE
676    CACHE 1;
677
678
679SET default_tablespace = '';
680
681SET default_with_oids = false;
682
683--
684-- Name: revisions; Type: TABLE; Schema: public; Owner: -; Tablespace:
685--
686
687CREATE TABLE revisions (
688    rev integer NOT NULL,
689    date timestamp with time zone DEFAULT now() NOT NULL,
690    "create" timestamp with time zone DEFAULT now() NOT NULL,
691    ikey integer DEFAULT nextval('ikey_seq'::regclass) NOT NULL
692);
693
694
695--
696-- Name: revisions_rev_seq; Type: SEQUENCE; Schema: public; Owner: -
697--
698
699CREATE SEQUENCE revisions_rev_seq
700    START WITH 1
701    INCREMENT BY 1
702    NO MAXVALUE
703    NO MINVALUE
704    CACHE 1;
705
706
707--
708-- Name: revisions_rev_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
709--
710
711ALTER SEQUENCE revisions_rev_seq OWNED BY revisions.rev;
712
713
714--
715-- Name: objects; Type: TABLE; Schema: public; Owner: -; Tablespace:
716--
717
718CREATE TABLE objects (
719    exported boolean DEFAULT true NOT NULL,
720    name text NOT NULL
721)
722INHERITS (revisions);
723
724
725--
726-- Name: accreq; Type: TABLE; Schema: public; Owner: -; Tablespace:
727--
728
729CREATE TABLE accreq (
730)
731INHERITS (objects);
732
733
734--
735-- Name: attributes; Type: TABLE; Schema: public; Owner: -; Tablespace:
736--
737
738CREATE TABLE attributes (
739    value text NOT NULL,
740    attr_key integer NOT NULL,
741    okey integer NOT NULL,
742    attr text NOT NULL
743);
744
745
746--
747-- Name: attributes_attr_key_seq; Type: SEQUENCE; Schema: public; Owner: -
748--
749
750CREATE SEQUENCE attributes_attr_key_seq
751    START WITH 1
752    INCREMENT BY 1
753    NO MAXVALUE
754    NO MINVALUE
755    CACHE 1;
756
757
758--
759-- Name: attributes_attr_key_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
760--
761
762ALTER SEQUENCE attributes_attr_key_seq OWNED BY attributes.attr_key;
763
764
765--
766-- Name: accreq_attributes; Type: TABLE; Schema: public; Owner: -; Tablespace:
767--
768
769CREATE TABLE accreq_attributes (
770)
771INHERITS (attributes);
772
773
774--
775-- Name: attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace:
776--
777
778CREATE TABLE attributes_list (
779    canonical text NOT NULL,
780    ikey integer DEFAULT nextval('ikey_seq'::regclass) NOT NULL,
781    description text
782);
783
784
785--
786-- Name: COLUMN attributes_list.canonical; Type: COMMENT; Schema: public; Owner: -
787--
788
789COMMENT ON COLUMN attributes_list.canonical IS 'Nom de l''attribut';
790
791
792--
793-- Name: COLUMN attributes_list.ikey; Type: COMMENT; Schema: public; Owner: -
794--
795
796COMMENT ON COLUMN attributes_list.ikey IS 'Clef interne à la base';
797
798
799--
800-- Name: accreq_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace:
801--
802
803CREATE TABLE accreq_attributes_list (
804    ikey integer,
805    rev integer DEFAULT nextval('revisions_rev_seq'::regclass) NOT NULL,
806    date timestamp with time zone DEFAULT now() NOT NULL,
807    "create" timestamp with time zone DEFAULT now() NOT NULL
808)
809INHERITS (attributes_list);
810
811
812--
813-- Name: address_seq; Type: SEQUENCE; Schema: public; Owner: -
814--
815
816CREATE SEQUENCE address_seq
817    START WITH 1
818    INCREMENT BY 1
819    NO MAXVALUE
820    NO MINVALUE
821    CACHE 1;
822
823
824--
825-- Name: address; Type: TABLE; Schema: public; Owner: -; Tablespace:
826--
827
828CREATE TABLE address (
829    name text DEFAULT ('address'::text || (nextval('address_seq'::regclass))::text),
830    "user" text NOT NULL
831)
832INHERITS (objects);
833
834
835--
836-- Name: address_attributes_base; Type: TABLE; Schema: public; Owner: -; Tablespace:
837--
838
839CREATE TABLE address_attributes_base (
840)
841INHERITS (attributes);
842
843
844--
845-- Name: address_attributes; Type: VIEW; Schema: public; Owner: -
846--
847
848CREATE VIEW address_attributes AS
849    (SELECT address."user" AS value, 'user' AS attr, address.rev AS attr_key, address.ikey AS okey FROM address UNION ALL SELECT address.name AS value, 'name' AS attr, address.rev AS attr_key, address.ikey AS okey FROM address) UNION ALL SELECT address_attributes.value, address_attributes.attr, address_attributes.attr_key, address_attributes.okey FROM address_attributes_base address_attributes;
850
851
852--
853-- Name: address_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace:
854--
855
856CREATE TABLE address_attributes_list (
857    rev integer,
858    date timestamp with time zone,
859    "create" timestamp with time zone
860)
861INHERITS (attributes_list, revisions);
862
863
864--
865-- Name: address_attributes_list_site; Type: TABLE; Schema: public; Owner: -; Tablespace:
866--
867
868CREATE TABLE address_attributes_list_site (
869)
870INHERITS (address_attributes_list);
871
872
873--
874-- Name: address_attributes_site; Type: TABLE; Schema: public; Owner: -; Tablespace:
875--
876
877CREATE TABLE address_attributes_site (
878)
879INHERITS (address_attributes_base);
880
881
882--
883-- Name: aliases; Type: TABLE; Schema: public; Owner: -; Tablespace:
884--
885
886CREATE TABLE aliases (
887    forward text[],
888    expire timestamp with time zone
889)
890INHERITS (objects);
891
892
893--
894-- Name: TABLE aliases; Type: COMMENT; Schema: public; Owner: -
895--
896
897COMMENT ON TABLE aliases IS 'Mail aliases';
898
899
900--
901-- Name: user; Type: TABLE; Schema: public; Owner: -; Tablespace:
902--
903
904CREATE TABLE "user" (
905    name text,
906    uidnumber integer NOT NULL,
907    gidnumber integer NOT NULL,
908    expire timestamp with time zone,
909    CONSTRAINT uid_not_empty CHECK ((name <> ''::text))
910)
911INHERITS (objects);
912
913
914--
915-- Name: aliases_attributes; Type: VIEW; Schema: public; Owner: -
916--
917
918CREATE VIEW aliases_attributes AS
919    SELECT "user".name AS value, 'user'::text AS attr, aliases.rev AS attr_key, aliases.ikey AS okey FROM (aliases JOIN "user" ON (((aliases.name = "user".name) OR (aliases.forward = ARRAY["user".name]))));
920
921
922--
923-- Name: aliases_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace:
924--
925
926CREATE TABLE aliases_attributes_list (
927    ikey integer,
928    canonical text,
929    description text
930)
931INHERITS (revisions, attributes_list);
932
933
934--
935-- Name: all_obj_attributes; Type: VIEW; Schema: public; Owner: -
936--
937
938CREATE VIEW all_obj_attributes AS
939    SELECT pg_class.relname, objects.name, attributes_list.description, attributes.attr_key, attributes.attr, attributes.value FROM (((attributes_list JOIN attributes ON ((attributes.attr = attributes_list.canonical))) JOIN pg_class ON ((attributes.tableoid = pg_class.oid))) JOIN objects ON ((objects.ikey = attributes.okey)));
940
941
942--
943-- Name: group; Type: TABLE; Schema: public; Owner: -; Tablespace:
944--
945
946CREATE TABLE "group" (
947    name text,
948    gidnumber integer NOT NULL,
949    CONSTRAINT group_name_not_empty CHECK ((name <> ''::text))
950)
951INHERITS (objects);
952
953
954--
955-- Name: group_attributes_base; Type: TABLE; Schema: public; Owner: -; Tablespace:
956--
957
958CREATE TABLE group_attributes_base (
959)
960INHERITS (attributes);
961
962
963--
964-- Name: user_attributes_base; Type: TABLE; Schema: public; Owner: -; Tablespace:
965--
966
967CREATE TABLE user_attributes_base (
968)
969INHERITS (attributes);
970
971
972--
973-- Name: group_attributes; Type: VIEW; Schema: public; Owner: -
974--
975
976CREATE VIEW group_attributes AS
977    (((SELECT ("group".gidnumber)::text AS value, 'gidnumber' AS attr, "group".rev AS attr_key, "group".ikey AS okey FROM "group" UNION ALL SELECT "group".name AS value, 'name' AS attr, "group".rev AS attr_key, "group".ikey AS okey FROM "group") UNION ALL SELECT '1'::text AS value, 'exported' AS attr, "group".rev AS attr_key, "group".ikey AS okey FROM "group" WHERE ("group".exported = true)) UNION ALL SELECT group_attributes.value, group_attributes.attr, group_attributes.attr_key, group_attributes.okey FROM group_attributes_base group_attributes) UNION ALL SELECT "user".name AS value, 'memberUID' AS attr, user_attributes_base.attr_key, "group".ikey AS okey FROM ((user_attributes_base JOIN "user" ON (("user".ikey = user_attributes_base.okey))) JOIN "group" ON (("group".name = user_attributes_base.value))) WHERE (user_attributes_base.attr = 'contratType'::text);
978
979
980--
981-- Name: group_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace:
982--
983
984CREATE TABLE group_attributes_list (
985)
986INHERITS (revisions, attributes_list);
987
988
989--
990-- Name: group_attributes_sutypes; Type: TABLE; Schema: public; Owner: -; Tablespace:
991--
992
993CREATE TABLE group_attributes_sutypes (
994)
995INHERITS (group_attributes_base);
996
997
998--
999-- Name: group_attributes_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
1000--
1001
1002CREATE TABLE group_attributes_users (
1003)
1004INHERITS (group_attributes_base);
1005
1006
1007--
1008-- Name: nethost; Type: TABLE; Schema: public; Owner: -; Tablespace:
1009--
1010
1011CREATE TABLE nethost (
1012)
1013INHERITS (objects);
1014
1015
1016--
1017-- Name: nethost_attributes; Type: TABLE; Schema: public; Owner: -; Tablespace:
1018--
1019
1020CREATE TABLE nethost_attributes (
1021)
1022INHERITS (attributes);
1023
1024
1025--
1026-- Name: nethost_attributes_ips; Type: TABLE; Schema: public; Owner: -; Tablespace:
1027--
1028
1029CREATE TABLE nethost_attributes_ips (
1030)
1031INHERITS (nethost_attributes);
1032
1033
1034--
1035-- Name: nethost_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace:
1036--
1037
1038CREATE TABLE nethost_attributes_list (
1039    ikey integer,
1040    canonical text,
1041    description text
1042)
1043INHERITS (revisions, attributes_list);
1044
1045
1046--
1047-- Name: nethost_attributes_macs; Type: TABLE; Schema: public; Owner: -; Tablespace:
1048--
1049
1050CREATE TABLE nethost_attributes_macs (CONSTRAINT nethost_valid_mac_address CHECK (((value)::macaddr <> '00:00:00:00:00:00'::macaddr))
1051)
1052INHERITS (nethost_attributes);
1053
1054
1055--
1056-- Name: nethost_attributes_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
1057--
1058
1059CREATE TABLE nethost_attributes_users (
1060)
1061INHERITS (nethost_attributes);
1062
1063
1064--
1065-- Name: netzone; Type: TABLE; Schema: public; Owner: -; Tablespace:
1066--
1067
1068CREATE TABLE netzone (
1069)
1070INHERITS (objects);
1071
1072
1073--
1074-- Name: netzone_attributes; Type: TABLE; Schema: public; Owner: -; Tablespace:
1075--
1076
1077CREATE TABLE netzone_attributes (
1078)
1079INHERITS (attributes);
1080
1081
1082--
1083-- Name: netzone_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace:
1084--
1085
1086CREATE TABLE netzone_attributes_list (
1087    ikey integer,
1088    canonical text,
1089    description text
1090)
1091INHERITS (revisions, attributes_list);
1092
1093
1094--
1095-- Name: netzone_attributes_netzone; Type: TABLE; Schema: public; Owner: -; Tablespace:
1096--
1097
1098CREATE TABLE netzone_attributes_netzone (
1099)
1100INHERITS (netzone_attributes);
1101
1102
1103--
1104-- Name: netzone_attributes_site; Type: TABLE; Schema: public; Owner: -; Tablespace:
1105--
1106
1107CREATE TABLE netzone_attributes_site (
1108)
1109INHERITS (netzone_attributes);
1110
1111
1112--
1113-- Name: objects_table; Type: VIEW; Schema: public; Owner: -
1114--
1115
1116CREATE VIEW objects_table AS
1117    SELECT objects.rev, objects.date, objects."create", objects.ikey, pg_class.relname, objects.name, objects.exported FROM (objects JOIN pg_class ON ((objects.tableoid = pg_class.oid)));
1118
1119
1120--
1121-- Name: revaliases; Type: TABLE; Schema: public; Owner: -; Tablespace:
1122--
1123
1124CREATE TABLE revaliases (
1125    "as" text NOT NULL
1126)
1127INHERITS (objects);
1128
1129
1130--
1131-- Name: revisions_table; Type: VIEW; Schema: public; Owner: -
1132--
1133
1134CREATE VIEW revisions_table AS
1135    SELECT revisions.rev, revisions.date, revisions."create", revisions.ikey, pg_class.relname FROM (revisions JOIN pg_class ON ((revisions.tableoid = pg_class.oid)));
1136
1137
1138--
1139-- Name: settings; Type: TABLE; Schema: public; Owner: -; Tablespace:
1140--
1141
1142CREATE TABLE settings (
1143    varname text NOT NULL,
1144    val text
1145)
1146INHERITS (revisions);
1147
1148
1149--
1150-- Name: site; Type: TABLE; Schema: public; Owner: -; Tablespace:
1151--
1152
1153CREATE TABLE site (
1154    name text
1155)
1156INHERITS (objects);
1157
1158
1159--
1160-- Name: site_attributes; Type: TABLE; Schema: public; Owner: -; Tablespace:
1161--
1162
1163CREATE TABLE site_attributes (
1164)
1165INHERITS (attributes);
1166
1167
1168--
1169-- Name: site_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace:
1170--
1171
1172CREATE TABLE site_attributes_list (
1173)
1174INHERITS (revisions, attributes_list);
1175
1176
1177--
1178-- Name: su_type; Type: TABLE; Schema: public; Owner: -; Tablespace:
1179--
1180
1181CREATE TABLE su_type (
1182    name text,
1183    description text
1184)
1185INHERITS (objects);
1186
1187
1188--
1189-- Name: user_attributes; Type: VIEW; Schema: public; Owner: -
1190--
1191
1192CREATE VIEW user_attributes AS
1193    (((((((((((SELECT ("user".uidnumber)::text AS value, 'uidnumber' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" UNION ALL SELECT ("user".gidnumber)::text AS value, 'gidnumber' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user") UNION ALL SELECT "user".name AS value, 'name' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user") UNION ALL SELECT ("user".expire)::text AS value, 'expire' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" WHERE ("user".expire IS NOT NULL)) UNION ALL SELECT '1'::text AS value, 'exported' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" WHERE ("user".exported = true)) UNION ALL SELECT address_attributes_site.value, 'allsite' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM (("user" JOIN address ON ((address."user" = "user".name))) JOIN address_attributes_site ON ((address_attributes_site.okey = address.ikey))) WHERE ((address_attributes_site.attr = 'site'::text) AND (address.exported = true))) UNION ALL SELECT "group".name AS value, 'memberOf' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM (("user" JOIN group_attributes ON ((group_attributes.value = "user".name))) JOIN "group" ON ((group_attributes.okey = "group".ikey))) WHERE (group_attributes.attr = 'memberUID'::text)) UNION ALL SELECT user_attributes.value, user_attributes.attr, user_attributes.attr_key, user_attributes.okey FROM user_attributes_base user_attributes) UNION ALL SELECT "group".name AS value, 'departments' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM ((("group" JOIN group_attributes_sutypes ON (("group".ikey = group_attributes_sutypes.okey))) JOIN group_attributes_users ON ((("group".ikey = group_attributes_users.okey) AND (group_attributes_users.attr = 'memberUID'::text)))) JOIN "user" ON (("user".name = group_attributes_users.value))) WHERE ((group_attributes_sutypes.value = 'dpmt'::text) AND (group_attributes_sutypes.attr = 'sutype'::text))) UNION ALL SELECT "group".name AS value, 'cells' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM ((("group" JOIN group_attributes_sutypes ON (("group".ikey = group_attributes_sutypes.okey))) JOIN group_attributes_users ON ((("group".ikey = group_attributes_users.okey) AND (group_attributes_users.attr = 'memberUID'::text)))) JOIN "user" ON (("user".name = group_attributes_users.value))) WHERE ((group_attributes_sutypes.value = 'cell'::text) AND (group_attributes_sutypes.attr = 'sutype'::text))) UNION ALL SELECT "group".name AS value, 'managedObjects' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM (("user" JOIN group_attributes ON ((group_attributes.value = "user".name))) JOIN "group" ON ((group_attributes.okey = "group".ikey))) WHERE (group_attributes.attr = 'managedBy'::text)) UNION ALL SELECT (justify_interval((now() - "user".expire)))::text AS value, 'expired' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" WHERE ("user".expire <= now())) UNION ALL SELECT (1)::text AS value, 'active' AS attr, "user".rev AS attr_key, "user".ikey AS okey FROM "user" WHERE ((("user".expire IS NULL) OR ("user".expire >= now())) AND ("user".exported = true));
1194
1195
1196--
1197-- Name: user_attributes_groups; Type: TABLE; Schema: public; Owner: -; Tablespace:
1198--
1199
1200CREATE TABLE user_attributes_groups (
1201)
1202INHERITS (user_attributes_base);
1203
1204
1205--
1206-- Name: user_attributes_list; Type: TABLE; Schema: public; Owner: -; Tablespace:
1207--
1208
1209CREATE TABLE user_attributes_list (
1210)
1211INHERITS (revisions, attributes_list);
1212
1213
1214--
1215-- Name: user_attributes_site; Type: TABLE; Schema: public; Owner: -; Tablespace:
1216--
1217
1218CREATE TABLE user_attributes_site (
1219)
1220INHERITS (user_attributes_base);
1221
1222
1223--
1224-- Name: user_attributes_users; Type: TABLE; Schema: public; Owner: -; Tablespace:
1225--
1226
1227CREATE TABLE user_attributes_users (
1228)
1229INHERITS (user_attributes_base);
1230
1231
1232--
1233-- Name: attr_key; Type: DEFAULT; Schema: public; Owner: -
1234--
1235
1236ALTER TABLE address_attributes ALTER COLUMN attr_key SET DEFAULT nextval('attributes_attr_key_seq'::regclass);
1237
1238
1239--
1240-- Name: attr_key; Type: DEFAULT; Schema: public; Owner: -
1241--
1242
1243ALTER TABLE attributes ALTER COLUMN attr_key SET DEFAULT nextval('attributes_attr_key_seq'::regclass);
1244
1245
1246--
1247-- Name: attr_key; Type: DEFAULT; Schema: public; Owner: -
1248--
1249
1250ALTER TABLE group_attributes ALTER COLUMN attr_key SET DEFAULT nextval('attributes_attr_key_seq'::regclass);
1251
1252
1253--
1254-- Name: rev; Type: DEFAULT; Schema: public; Owner: -
1255--
1256
1257ALTER TABLE revisions ALTER COLUMN rev SET DEFAULT nextval('revisions_rev_seq'::regclass);
1258
1259
1260--
1261-- Name: attr_key; Type: DEFAULT; Schema: public; Owner: -
1262--
1263
1264ALTER TABLE user_attributes ALTER COLUMN attr_key SET DEFAULT nextval('attributes_attr_key_seq'::regclass);
1265
1266
1267--
1268-- Name: acccreq_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1269--
1270
1271ALTER TABLE ONLY accreq_attributes_list
1272    ADD CONSTRAINT acccreq_attributes_list_pkey PRIMARY KEY (canonical);
1273
1274
1275--
1276-- Name: accreq_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1277--
1278
1279ALTER TABLE ONLY accreq_attributes
1280    ADD CONSTRAINT accreq_attributes_pkey PRIMARY KEY (attr_key);
1281
1282
1283--
1284-- Name: accreq_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1285--
1286
1287ALTER TABLE ONLY accreq
1288    ADD CONSTRAINT accreq_ikey_uniq UNIQUE (ikey);
1289
1290
1291--
1292-- Name: accreq_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1293--
1294
1295ALTER TABLE ONLY accreq
1296    ADD CONSTRAINT accreq_pkey PRIMARY KEY (name);
1297
1298
1299--
1300-- Name: address_attr_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1301--
1302
1303ALTER TABLE ONLY address_attributes_base
1304    ADD CONSTRAINT address_attr_pkey PRIMARY KEY (attr_key);
1305
1306
1307--
1308-- Name: address_attr_site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1309--
1310
1311ALTER TABLE ONLY address_attributes_site
1312    ADD CONSTRAINT address_attr_site_pkey PRIMARY KEY (attr_key);
1313
1314
1315--
1316-- Name: address_attributes_list_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1317--
1318
1319ALTER TABLE ONLY address_attributes_list
1320    ADD CONSTRAINT address_attributes_list_c_uniq UNIQUE (canonical);
1321
1322
1323--
1324-- Name: address_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1325--
1326
1327ALTER TABLE ONLY address_attributes_list
1328    ADD CONSTRAINT address_attributes_list_pkey PRIMARY KEY (ikey);
1329
1330
1331--
1332-- Name: address_attributes_list_site_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1333--
1334
1335ALTER TABLE ONLY address_attributes_list_site
1336    ADD CONSTRAINT address_attributes_list_site_c_uniq UNIQUE (canonical);
1337
1338
1339--
1340-- Name: address_attributes_list_site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1341--
1342
1343ALTER TABLE ONLY address_attributes_list_site
1344    ADD CONSTRAINT address_attributes_list_site_pkey PRIMARY KEY (ikey);
1345
1346
1347--
1348-- Name: address_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1349--
1350
1351ALTER TABLE ONLY address
1352    ADD CONSTRAINT address_ikey_uniq UNIQUE (ikey);
1353
1354
1355--
1356-- Name: address_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1357--
1358
1359ALTER TABLE ONLY address
1360    ADD CONSTRAINT address_pkey PRIMARY KEY (name);
1361
1362
1363--
1364-- Name: aliases_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1365--
1366
1367ALTER TABLE ONLY aliases_attributes_list
1368    ADD CONSTRAINT aliases_attributes_list_pkey PRIMARY KEY (ikey);
1369
1370
1371--
1372-- Name: aliases_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1373--
1374
1375ALTER TABLE ONLY aliases
1376    ADD CONSTRAINT aliases_pkey PRIMARY KEY (name);
1377
1378
1379--
1380-- Name: attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1381--
1382
1383ALTER TABLE ONLY attributes_list
1384    ADD CONSTRAINT attributes_list_pkey PRIMARY KEY (ikey);
1385
1386
1387--
1388-- Name: attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1389--
1390
1391ALTER TABLE ONLY attributes
1392    ADD CONSTRAINT attributes_pkey PRIMARY KEY (attr_key);
1393
1394
1395--
1396-- Name: g_attr_l_aliases_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1397--
1398
1399ALTER TABLE ONLY aliases_attributes_list
1400    ADD CONSTRAINT g_attr_l_aliases_uniq UNIQUE (canonical);
1401
1402
1403--
1404-- Name: g_attr_l_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1405--
1406
1407ALTER TABLE ONLY group_attributes_list
1408    ADD CONSTRAINT g_attr_l_c_uniq UNIQUE (canonical);
1409
1410
1411--
1412-- Name: g_attr_l_nethost_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1413--
1414
1415ALTER TABLE ONLY nethost_attributes_list
1416    ADD CONSTRAINT g_attr_l_nethost_uniq UNIQUE (canonical);
1417
1418
1419--
1420-- Name: g_attr_l_netzone_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1421--
1422
1423ALTER TABLE ONLY netzone_attributes_list
1424    ADD CONSTRAINT g_attr_l_netzone_uniq UNIQUE (canonical);
1425
1426
1427--
1428-- Name: g_attr_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1429--
1430
1431ALTER TABLE ONLY group_attributes_list
1432    ADD CONSTRAINT g_attr_list_pkey PRIMARY KEY (ikey);
1433
1434
1435--
1436-- Name: goup_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1437--
1438
1439ALTER TABLE ONLY "group"
1440    ADD CONSTRAINT goup_pkey PRIMARY KEY (name);
1441
1442
1443--
1444-- Name: group_attrbutes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1445--
1446
1447ALTER TABLE ONLY group_attributes_base
1448    ADD CONSTRAINT group_attrbutes_pkey PRIMARY KEY (attr_key);
1449
1450
1451--
1452-- Name: group_attributes_sutypes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1453--
1454
1455ALTER TABLE ONLY group_attributes_sutypes
1456    ADD CONSTRAINT group_attributes_sutypes_pkey PRIMARY KEY (attr_key);
1457
1458
1459--
1460-- Name: group_attributes_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1461--
1462
1463ALTER TABLE ONLY group_attributes_users
1464    ADD CONSTRAINT group_attributes_user_pkey PRIMARY KEY (attr_key);
1465
1466
1467--
1468-- Name: group_attributes_users_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1469--
1470
1471ALTER TABLE ONLY group_attributes_users
1472    ADD CONSTRAINT group_attributes_users_uniq UNIQUE (okey, attr, value);
1473
1474
1475--
1476-- Name: group_gid_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1477--
1478
1479ALTER TABLE ONLY "group"
1480    ADD CONSTRAINT group_gid_uniq UNIQUE (gidnumber);
1481
1482
1483--
1484-- Name: group_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1485--
1486
1487ALTER TABLE ONLY "group"
1488    ADD CONSTRAINT group_ikey_uniq UNIQUE (ikey);
1489
1490
1491--
1492-- Name: nethost_attributes_ip_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1493--
1494
1495ALTER TABLE ONLY nethost_attributes_ips
1496    ADD CONSTRAINT nethost_attributes_ip_pkey PRIMARY KEY (attr_key);
1497
1498
1499--
1500-- Name: nethost_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1501--
1502
1503ALTER TABLE ONLY nethost_attributes_list
1504    ADD CONSTRAINT nethost_attributes_list_pkey PRIMARY KEY (ikey);
1505
1506
1507--
1508-- Name: nethost_attributes_mac_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1509--
1510
1511ALTER TABLE ONLY nethost_attributes_macs
1512    ADD CONSTRAINT nethost_attributes_mac_pkey PRIMARY KEY (attr_key);
1513
1514
1515--
1516-- Name: nethost_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1517--
1518
1519ALTER TABLE ONLY nethost_attributes
1520    ADD CONSTRAINT nethost_attributes_pkey PRIMARY KEY (attr_key);
1521
1522
1523--
1524-- Name: nethost_attributes_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1525--
1526
1527ALTER TABLE ONLY nethost_attributes_users
1528    ADD CONSTRAINT nethost_attributes_user_pkey PRIMARY KEY (attr_key);
1529
1530
1531--
1532-- Name: nethost_attributes_users_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1533--
1534
1535ALTER TABLE ONLY nethost_attributes_users
1536    ADD CONSTRAINT nethost_attributes_users_uniq UNIQUE (okey, attr, value);
1537
1538
1539--
1540-- Name: nethost_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1541--
1542
1543ALTER TABLE ONLY nethost
1544    ADD CONSTRAINT nethost_ikey_uniq UNIQUE (ikey);
1545
1546
1547--
1548-- Name: nethost_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1549--
1550
1551ALTER TABLE ONLY nethost
1552    ADD CONSTRAINT nethost_pkey PRIMARY KEY (name);
1553
1554
1555--
1556-- Name: netzone_attr_netzone_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1557--
1558
1559ALTER TABLE ONLY netzone_attributes_netzone
1560    ADD CONSTRAINT netzone_attr_netzone_pkey PRIMARY KEY (attr_key);
1561
1562
1563--
1564-- Name: netzone_attr_site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1565--
1566
1567ALTER TABLE ONLY netzone_attributes_site
1568    ADD CONSTRAINT netzone_attr_site_pkey PRIMARY KEY (attr_key);
1569
1570
1571--
1572-- Name: netzone_attributes_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1573--
1574
1575ALTER TABLE ONLY netzone_attributes_list
1576    ADD CONSTRAINT netzone_attributes_list_pkey PRIMARY KEY (ikey);
1577
1578
1579--
1580-- Name: netzone_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1581--
1582
1583ALTER TABLE ONLY netzone_attributes
1584    ADD CONSTRAINT netzone_attributes_pkey PRIMARY KEY (attr_key);
1585
1586
1587--
1588-- Name: netzone_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1589--
1590
1591ALTER TABLE ONLY netzone
1592    ADD CONSTRAINT netzone_ikey_uniq UNIQUE (ikey);
1593
1594
1595--
1596-- Name: netzone_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1597--
1598
1599ALTER TABLE ONLY netzone
1600    ADD CONSTRAINT netzone_pkey PRIMARY KEY (name);
1601
1602
1603--
1604-- Name: objects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1605--
1606
1607ALTER TABLE ONLY objects
1608    ADD CONSTRAINT objects_pkey PRIMARY KEY (ikey);
1609
1610
1611--
1612-- Name: p_attr_l_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1613--
1614
1615ALTER TABLE ONLY user_attributes_list
1616    ADD CONSTRAINT p_attr_l_c_uniq UNIQUE (canonical);
1617
1618
1619--
1620-- Name: p_attr_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1621--
1622
1623ALTER TABLE ONLY user_attributes_list
1624    ADD CONSTRAINT p_attr_list_pkey PRIMARY KEY (ikey);
1625
1626
1627--
1628-- Name: person_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1629--
1630
1631ALTER TABLE ONLY "user"
1632    ADD CONSTRAINT person_pkey PRIMARY KEY (name);
1633
1634
1635--
1636-- Name: person_uid_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1637--
1638
1639ALTER TABLE ONLY "user"
1640    ADD CONSTRAINT person_uid_key UNIQUE (uidnumber);
1641
1642
1643--
1644-- Name: revaliases_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1645--
1646
1647ALTER TABLE ONLY revaliases
1648    ADD CONSTRAINT revaliases_pkey PRIMARY KEY (name);
1649
1650
1651--
1652-- Name: revisions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1653--
1654
1655ALTER TABLE ONLY revisions
1656    ADD CONSTRAINT revisions_pkey PRIMARY KEY (ikey);
1657
1658
1659--
1660-- Name: s_attr_l_c_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1661--
1662
1663ALTER TABLE ONLY site_attributes_list
1664    ADD CONSTRAINT s_attr_l_c_uniq UNIQUE (canonical);
1665
1666
1667--
1668-- Name: s_attr_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1669--
1670
1671ALTER TABLE ONLY site_attributes_list
1672    ADD CONSTRAINT s_attr_list_pkey PRIMARY KEY (ikey);
1673
1674
1675--
1676-- Name: settings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1677--
1678
1679ALTER TABLE ONLY settings
1680    ADD CONSTRAINT settings_pkey PRIMARY KEY (varname);
1681
1682
1683--
1684-- Name: site_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1685--
1686
1687ALTER TABLE ONLY site_attributes
1688    ADD CONSTRAINT site_attributes_pkey PRIMARY KEY (attr_key);
1689
1690
1691--
1692-- Name: site_okey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1693--
1694
1695ALTER TABLE ONLY site
1696    ADD CONSTRAINT site_okey_uniq UNIQUE (ikey);
1697
1698
1699--
1700-- Name: site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1701--
1702
1703ALTER TABLE ONLY site
1704    ADD CONSTRAINT site_pkey PRIMARY KEY (name);
1705
1706
1707--
1708-- Name: su_type_name_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1709--
1710
1711ALTER TABLE ONLY su_type
1712    ADD CONSTRAINT su_type_name_uniq UNIQUE (name);
1713
1714
1715--
1716-- Name: su_type_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1717--
1718
1719ALTER TABLE ONLY su_type
1720    ADD CONSTRAINT su_type_pkey PRIMARY KEY (ikey);
1721
1722
1723--
1724-- Name: user_attr_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1725--
1726
1727ALTER TABLE ONLY user_attributes_groups
1728    ADD CONSTRAINT user_attr_groups_pkey PRIMARY KEY (attr_key);
1729
1730
1731--
1732-- Name: user_attr_site_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1733--
1734
1735ALTER TABLE ONLY user_attributes_site
1736    ADD CONSTRAINT user_attr_site_pkey PRIMARY KEY (attr_key);
1737
1738
1739--
1740-- Name: user_attr_user_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1741--
1742
1743ALTER TABLE ONLY user_attributes_users
1744    ADD CONSTRAINT user_attr_user_pkey PRIMARY KEY (attr_key);
1745
1746
1747--
1748-- Name: user_attributes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1749--
1750
1751ALTER TABLE ONLY user_attributes_base
1752    ADD CONSTRAINT user_attributes_pkey PRIMARY KEY (attr_key);
1753
1754
1755--
1756-- Name: user_ikey_uniq; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1757--
1758
1759ALTER TABLE ONLY "user"
1760    ADD CONSTRAINT user_ikey_uniq UNIQUE (ikey);
1761
1762
1763--
1764-- Name: address_attr_base_attr_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1765--
1766
1767CREATE INDEX address_attr_base_attr_idx ON address_attributes_base USING btree (attr);
1768
1769
1770--
1771-- Name: address_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1772--
1773
1774CREATE INDEX address_exported_idx ON address USING btree (exported);
1775
1776
1777--
1778-- Name: aliases_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1779--
1780
1781CREATE INDEX aliases_exported_idx ON aliases USING btree (exported);
1782
1783
1784--
1785-- Name: aliases_forwards_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1786--
1787
1788CREATE INDEX aliases_forwards_idx ON aliases USING gin (forward);
1789
1790
1791--
1792-- Name: aliases_forwards_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1793--
1794
1795CREATE INDEX aliases_forwards_lower_idx ON aliases USING gin (string_to_array(lower(array_to_string(forward, ','::text)), ','::text));
1796
1797
1798--
1799-- Name: aliases_name_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1800--
1801
1802CREATE UNIQUE INDEX aliases_name_lower_idx ON aliases USING btree (lower(name));
1803
1804
1805--
1806-- Name: aliases_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
1807--
1808
1809CREATE INDEX aliases_rev_idx ON aliases USING btree (rev);
1810
1811
1812--
1813-- Name: fki_accreq_attr_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1814--
1815
1816CREATE INDEX fki_accreq_attr_okey_fkey ON accreq_attributes USING btree (okey);
1817
1818
1819--
1820-- Name: fki_accreq_attributes_list_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1821--
1822
1823CREATE INDEX fki_accreq_attributes_list_attr_fkey ON accreq_attributes USING btree (attr);
1824
1825
1826--
1827-- Name: fki_address_attr_site_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1828--
1829
1830CREATE INDEX fki_address_attr_site_okey_fkey ON address_attributes_site USING btree (okey);
1831
1832
1833--
1834-- Name: fki_address_attributes_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1835--
1836
1837CREATE INDEX fki_address_attributes_okey_fkey ON address_attributes_base USING btree (okey);
1838
1839
1840--
1841-- Name: fki_address_attributes_site_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1842--
1843
1844CREATE INDEX fki_address_attributes_site_attr_fkey ON address_attributes_site USING btree (attr);
1845
1846
1847--
1848-- Name: fki_address_attributes_site_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1849--
1850
1851CREATE INDEX fki_address_attributes_site_value_fkey ON address_attributes_site USING btree (value);
1852
1853
1854--
1855-- Name: fki_address_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1856--
1857
1858CREATE INDEX fki_address_user_fkey ON address USING btree ("user");
1859
1860
1861--
1862-- Name: fki_group_attr_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1863--
1864
1865CREATE INDEX fki_group_attr_okey_fkey ON group_attributes_base USING btree (okey);
1866
1867
1868--
1869-- Name: fki_group_attr_sutypes_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1870--
1871
1872CREATE INDEX fki_group_attr_sutypes_okey_fkey ON group_attributes_sutypes USING btree (okey);
1873
1874
1875--
1876-- Name: fki_group_attr_users_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1877--
1878
1879CREATE INDEX fki_group_attr_users_okey_fkey ON group_attributes_users USING btree (okey);
1880
1881
1882--
1883-- Name: fki_group_attributes_sutypes_attr; Type: INDEX; Schema: public; Owner: -; Tablespace:
1884--
1885
1886CREATE INDEX fki_group_attributes_sutypes_attr ON group_attributes_sutypes USING btree (attr);
1887
1888
1889--
1890-- Name: fki_group_attributes_sutypes_sutype_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1891--
1892
1893CREATE INDEX fki_group_attributes_sutypes_sutype_fkey ON group_attributes_sutypes USING btree (value);
1894
1895
1896--
1897-- Name: fki_group_attributes_users_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1898--
1899
1900CREATE INDEX fki_group_attributes_users_attr_fkey ON group_attributes_users USING btree (attr);
1901
1902
1903--
1904-- Name: fki_group_attributes_users_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1905--
1906
1907CREATE INDEX fki_group_attributes_users_user_fkey ON group_attributes_users USING btree (value);
1908
1909
1910--
1911-- Name: fki_nethost_attr_ip_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1912--
1913
1914CREATE INDEX fki_nethost_attr_ip_fkey ON nethost_attributes_ips USING btree (okey);
1915
1916
1917--
1918-- Name: fki_nethost_attr_mac_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1919--
1920
1921CREATE INDEX fki_nethost_attr_mac_fkey ON nethost_attributes_macs USING btree (okey);
1922
1923
1924--
1925-- Name: fki_nethost_attr_users_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1926--
1927
1928CREATE INDEX fki_nethost_attr_users_okey_fkey ON nethost_attributes_users USING btree (okey);
1929
1930
1931--
1932-- Name: fki_nethost_attributes_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1933--
1934
1935CREATE INDEX fki_nethost_attributes_attr_fkey ON nethost_attributes USING btree (attr);
1936
1937
1938--
1939-- Name: fki_nethost_attributes_users_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1940--
1941
1942CREATE INDEX fki_nethost_attributes_users_attr_fkey ON nethost_attributes_users USING btree (attr);
1943
1944
1945--
1946-- Name: fki_nethost_attributes_users_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1947--
1948
1949CREATE INDEX fki_nethost_attributes_users_user_fkey ON nethost_attributes_users USING btree (value);
1950
1951
1952--
1953-- Name: fki_netzone_attr_netzone_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1954--
1955
1956CREATE INDEX fki_netzone_attr_netzone_okey_fkey ON netzone_attributes_netzone USING btree (okey);
1957
1958
1959--
1960-- Name: fki_netzone_attr_site_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1961--
1962
1963CREATE INDEX fki_netzone_attr_site_okey_fkey ON netzone_attributes_site USING btree (okey);
1964
1965
1966--
1967-- Name: fki_netzone_attributes_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1968--
1969
1970CREATE INDEX fki_netzone_attributes_attr_fkey ON netzone_attributes USING btree (attr);
1971
1972
1973--
1974-- Name: fki_netzone_attributes_netzone_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1975--
1976
1977CREATE INDEX fki_netzone_attributes_netzone_attr_fkey ON netzone_attributes_netzone USING btree (attr);
1978
1979
1980--
1981-- Name: fki_netzone_attributes_netzone_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1982--
1983
1984CREATE INDEX fki_netzone_attributes_netzone_value_fkey ON netzone_attributes_netzone USING btree (value);
1985
1986
1987--
1988-- Name: fki_netzone_attributes_site_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1989--
1990
1991CREATE INDEX fki_netzone_attributes_site_attr_fkey ON netzone_attributes_site USING btree (attr);
1992
1993
1994--
1995-- Name: fki_netzone_attributes_site_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
1996--
1997
1998CREATE INDEX fki_netzone_attributes_site_value_fkey ON netzone_attributes_site USING btree (value);
1999
2000
2001--
2002-- Name: fki_revaliase_name_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2003--
2004
2005CREATE INDEX fki_revaliase_name_user_fkey ON revaliases USING btree (name);
2006
2007
2008--
2009-- Name: fki_revaliases_user_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2010--
2011
2012CREATE INDEX fki_revaliases_user_fkey ON revaliases USING btree (name);
2013
2014
2015--
2016-- Name: fki_site_attributes_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2017--
2018
2019CREATE INDEX fki_site_attributes_attr_fkey ON site_attributes USING btree (attr);
2020
2021
2022--
2023-- Name: fki_user_attr_groups_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2024--
2025
2026CREATE INDEX fki_user_attr_groups_okey_fkey ON user_attributes_groups USING btree (okey);
2027
2028
2029--
2030-- Name: fki_user_attr_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2031--
2032
2033CREATE INDEX fki_user_attr_okey_fkey ON user_attributes_base USING btree (okey);
2034
2035
2036--
2037-- Name: fki_user_attr_site_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2038--
2039
2040CREATE INDEX fki_user_attr_site_okey_fkey ON user_attributes_site USING btree (okey);
2041
2042
2043--
2044-- Name: fki_user_attr_users_okey_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2045--
2046
2047CREATE INDEX fki_user_attr_users_okey_fkey ON user_attributes_users USING btree (okey);
2048
2049
2050--
2051-- Name: fki_user_attributes_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2052--
2053
2054CREATE INDEX fki_user_attributes_attr_fkey ON user_attributes_base USING btree (attr);
2055
2056
2057--
2058-- Name: fki_user_attributes_groups_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2059--
2060
2061CREATE INDEX fki_user_attributes_groups_attr_fkey ON user_attributes_groups USING btree (attr);
2062
2063
2064--
2065-- Name: fki_user_attributes_groups_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2066--
2067
2068CREATE INDEX fki_user_attributes_groups_value_fkey ON user_attributes_groups USING btree (value);
2069
2070
2071--
2072-- Name: fki_user_attributes_site_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2073--
2074
2075CREATE INDEX fki_user_attributes_site_attr_fkey ON user_attributes_site USING btree (attr);
2076
2077
2078--
2079-- Name: fki_user_attributes_site_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2080--
2081
2082CREATE INDEX fki_user_attributes_site_value_fkey ON user_attributes_site USING btree (value);
2083
2084
2085--
2086-- Name: fki_user_attributes_users_attr_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2087--
2088
2089CREATE INDEX fki_user_attributes_users_attr_fkey ON user_attributes_users USING btree (attr);
2090
2091
2092--
2093-- Name: fki_user_attributes_users_value_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace:
2094--
2095
2096CREATE INDEX fki_user_attributes_users_value_fkey ON user_attributes_users USING btree (value);
2097
2098
2099--
2100-- Name: group_attributes_base_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2101--
2102
2103CREATE INDEX group_attributes_base_value_idx ON group_attributes_base USING btree (value);
2104
2105
2106--
2107-- Name: group_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2108--
2109
2110CREATE INDEX group_exported_idx ON "group" USING btree (exported);
2111
2112
2113--
2114-- Name: group_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2115--
2116
2117CREATE INDEX group_rev_idx ON "group" USING btree (rev);
2118
2119
2120--
2121-- Name: nethost_attr_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2122--
2123
2124CREATE INDEX nethost_attr_value_idx ON nethost_attributes USING btree (value);
2125
2126
2127--
2128-- Name: nethost_attributes_ip_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2129--
2130
2131CREATE UNIQUE INDEX nethost_attributes_ip_idx ON nethost_attributes_ips USING btree (((value)::inet));
2132
2133
2134--
2135-- Name: nethost_attributes_mac_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2136--
2137
2138CREATE UNIQUE INDEX nethost_attributes_mac_idx ON nethost_attributes_macs USING btree (((value)::macaddr));
2139
2140
2141--
2142-- Name: nethost_cname_uniq_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2143--
2144
2145CREATE UNIQUE INDEX nethost_cname_uniq_idx ON nethost_attributes USING btree (value) WHERE (attr = 'cname'::text);
2146
2147
2148--
2149-- Name: netzone_attr_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2150--
2151
2152CREATE INDEX netzone_attr_value_idx ON netzone_attributes USING btree (value);
2153
2154
2155--
2156-- Name: netzone_attributes_net_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2157--
2158
2159CREATE UNIQUE INDEX netzone_attributes_net_idx ON netzone_attributes USING btree (((value)::inet), attr, okey) WHERE (attr = 'net'::text);
2160
2161
2162--
2163-- Name: netzone_attributes_netexclude_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2164--
2165
2166CREATE UNIQUE INDEX netzone_attributes_netexclude_idx ON netzone_attributes USING btree (((value)::inet), attr, okey) WHERE (attr = 'netExclude'::text);
2167
2168
2169--
2170-- Name: person_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2171--
2172
2173CREATE INDEX person_rev_idx ON "user" USING btree (rev);
2174
2175
2176--
2177-- Name: revaliases_as_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2178--
2179
2180CREATE INDEX revaliases_as_idx ON revaliases USING btree ("as");
2181
2182
2183--
2184-- Name: revaliases_as_lower_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2185--
2186
2187CREATE INDEX revaliases_as_lower_idx ON revaliases USING btree (lower("as"));
2188
2189
2190--
2191-- Name: revaliases_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2192--
2193
2194CREATE INDEX revaliases_exported_idx ON revaliases USING btree (exported);
2195
2196
2197--
2198-- Name: revaliases_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2199--
2200
2201CREATE INDEX revaliases_rev_idx ON revaliases USING btree (rev);
2202
2203
2204--
2205-- Name: site_attr_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2206--
2207
2208CREATE INDEX site_attr_value_idx ON site_attributes USING btree (value);
2209
2210
2211--
2212-- Name: site_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2213--
2214
2215CREATE INDEX site_exported_idx ON site USING btree (exported);
2216
2217
2218--
2219-- Name: site_rev_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2220--
2221
2222CREATE UNIQUE INDEX site_rev_idx ON site USING btree (rev);
2223
2224
2225--
2226-- Name: user_attr_value_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2227--
2228
2229CREATE INDEX user_attr_value_idx ON user_attributes_base USING btree (value);
2230
2231
2232--
2233-- Name: user_expire_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2234--
2235
2236CREATE INDEX user_expire_idx ON "user" USING btree (expire);
2237
2238
2239--
2240-- Name: user_exported_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
2241--
2242
2243CREATE INDEX user_exported_idx ON "user" USING btree (exported);
2244
2245
2246--
2247-- Name: address_attributes_insert; Type: RULE; Schema: public; Owner: -
2248--
2249
2250CREATE RULE address_attributes_insert AS ON INSERT TO address_attributes DO INSTEAD INSERT INTO address_attributes_base (value, attr, attr_key, okey) VALUES (new.value, new.attr, new.attr_key, new.okey);
2251
2252
2253--
2254-- Name: address_attributes_update; Type: RULE; Schema: public; Owner: -
2255--
2256
2257CREATE RULE address_attributes_update AS ON UPDATE TO address_attributes DO INSTEAD UPDATE address_attributes_base SET value = new.value, attr = new.attr, attr_key = new.attr_key, okey = new.okey WHERE ((address_attributes_base.attr_key = old.attr_key) AND (address_attributes_base.attr = old.attr));
2258
2259
2260--
2261-- Name: address_atttributes_delete; Type: RULE; Schema: public; Owner: -
2262--
2263
2264CREATE RULE address_atttributes_delete AS ON DELETE TO address_attributes DO INSTEAD DELETE FROM address_attributes_base WHERE ((address_attributes_base.attr_key = old.attr_key) AND (address_attributes_base.attr = old.attr));
2265
2266
2267--
2268-- Name: group_attributes_insert; Type: RULE; Schema: public; Owner: -
2269--
2270
2271CREATE RULE group_attributes_insert AS ON INSERT TO group_attributes DO INSTEAD INSERT INTO group_attributes_base (value, attr, attr_key, okey) VALUES (new.value, new.attr, new.attr_key, new.okey);
2272
2273
2274--
2275-- Name: group_attributes_update; Type: RULE; Schema: public; Owner: -
2276--
2277
2278CREATE RULE group_attributes_update AS ON UPDATE TO group_attributes DO INSTEAD UPDATE group_attributes_base SET value = new.value, attr = new.attr, attr_key = new.attr_key, okey = new.okey WHERE ((group_attributes_base.attr_key = old.attr_key) AND (group_attributes_base.attr = old.attr));
2279
2280
2281--
2282-- Name: group_atttributes_delete; Type: RULE; Schema: public; Owner: -
2283--
2284
2285CREATE RULE group_atttributes_delete AS ON DELETE TO group_attributes DO INSTEAD DELETE FROM group_attributes_base WHERE ((group_attributes_base.attr_key = old.attr_key) AND (group_attributes_base.attr = old.attr));
2286
2287
2288--
2289-- Name: user_attributes_insert; Type: RULE; Schema: public; Owner: -
2290--
2291
2292CREATE RULE user_attributes_insert AS ON INSERT TO user_attributes DO INSTEAD INSERT INTO user_attributes_base (value, attr, attr_key, okey) VALUES (new.value, new.attr, new.attr_key, new.okey);
2293
2294
2295--
2296-- Name: user_attributes_update; Type: RULE; Schema: public; Owner: -
2297--
2298
2299CREATE RULE user_attributes_update AS ON UPDATE TO user_attributes DO INSTEAD UPDATE user_attributes_base SET value = new.value, attr = new.attr, attr_key = new.attr_key, okey = new.okey WHERE ((user_attributes_base.attr_key = old.attr_key) AND (user_attributes_base.attr = old.attr));
2300
2301
2302--
2303-- Name: user_atttributes_delete; Type: RULE; Schema: public; Owner: -
2304--
2305
2306CREATE RULE user_atttributes_delete AS ON DELETE TO user_attributes DO INSTEAD DELETE FROM user_attributes_base WHERE ((user_attributes_base.attr_key = old.attr_key) AND (user_attributes_base.attr = old.attr));
2307
2308
2309--
2310-- Name: accreq_update_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2311--
2312
2313CREATE TRIGGER accreq_update_rev_tg
2314    BEFORE INSERT OR DELETE OR UPDATE ON accreq
2315    FOR EACH ROW
2316    EXECUTE PROCEDURE rev_tg_f();
2317
2318
2319--
2320-- Name: address_attr_update_ref_a_s; Type: TRIGGER; Schema: public; Owner: -
2321--
2322
2323CREATE TRIGGER address_attr_update_ref_a_s
2324    AFTER INSERT OR DELETE OR UPDATE ON address_attributes_site
2325    FOR EACH ROW
2326    EXECUTE PROCEDURE address_attr_update_ref();
2327
2328
2329--
2330-- Name: address_attr_update_ref_tg; Type: TRIGGER; Schema: public; Owner: -
2331--
2332
2333CREATE TRIGGER address_attr_update_ref_tg
2334    AFTER INSERT OR DELETE OR UPDATE ON address_attributes_base
2335    FOR EACH ROW
2336    EXECUTE PROCEDURE address_attr_update_ref();
2337
2338
2339--
2340-- Name: address_sort_fields_tg; Type: TRIGGER; Schema: public; Owner: -
2341--
2342
2343CREATE TRIGGER address_sort_fields_tg
2344    BEFORE INSERT OR DELETE OR UPDATE ON address_attributes_base
2345    FOR EACH ROW
2346    EXECUTE PROCEDURE address_sort_fields();
2347
2348
2349--
2350-- Name: address_update_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2351--
2352
2353CREATE TRIGGER address_update_rev_tg
2354    BEFORE INSERT OR DELETE OR UPDATE ON address
2355    FOR EACH ROW
2356    EXECUTE PROCEDURE rev_tg_f();
2357
2358
2359--
2360-- Name: address_update_user_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2361--
2362
2363CREATE TRIGGER address_update_user_rev_tg
2364    AFTER INSERT OR DELETE OR UPDATE ON address
2365    FOR EACH ROW
2366    EXECUTE PROCEDURE address_update_user_rev();
2367
2368
2369--
2370-- Name: aliases_nickname_tg; Type: TRIGGER; Schema: public; Owner: -
2371--
2372
2373CREATE TRIGGER aliases_nickname_tg
2374    AFTER DELETE OR UPDATE ON aliases
2375    FOR EACH ROW
2376    EXECUTE PROCEDURE aliases_nickname();
2377
2378
2379--
2380-- Name: aliases_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2381--
2382
2383CREATE TRIGGER aliases_rev_tg
2384    BEFORE INSERT OR DELETE OR UPDATE ON aliases
2385    FOR EACH ROW
2386    EXECUTE PROCEDURE rev_tg_f();
2387
2388
2389--
2390-- Name: department_group_upd_tg; Type: TRIGGER; Schema: public; Owner: -
2391--
2392
2393CREATE TRIGGER department_group_upd_tg
2394    AFTER INSERT OR UPDATE ON user_attributes_groups
2395    FOR EACH ROW
2396    EXECUTE PROCEDURE department_group_upd_f();
2397
2398
2399--
2400-- Name: fmt_macaddr_tg; Type: TRIGGER; Schema: public; Owner: -
2401--
2402
2403CREATE TRIGGER fmt_macaddr_tg
2404    BEFORE INSERT OR UPDATE ON nethost_attributes_macs
2405    FOR EACH ROW
2406    EXECUTE PROCEDURE fmt_macaddr();
2407
2408
2409--
2410-- Name: group_attr_update; Type: TRIGGER; Schema: public; Owner: -
2411--
2412
2413CREATE TRIGGER group_attr_update
2414    AFTER INSERT OR DELETE OR UPDATE ON group_attributes_base
2415    FOR EACH ROW
2416    EXECUTE PROCEDURE group_attr_update_ref();
2417
2418
2419--
2420-- Name: group_attr_user_update_user_ref_tg; Type: TRIGGER; Schema: public; Owner: -
2421--
2422
2423CREATE TRIGGER group_attr_user_update_user_ref_tg
2424    AFTER INSERT OR DELETE OR UPDATE ON group_attributes_users
2425    FOR EACH ROW
2426    EXECUTE PROCEDURE group_attr_user_update_user_ref();
2427
2428
2429--
2430-- Name: group_attributes_sutypes_update_ref; Type: TRIGGER; Schema: public; Owner: -
2431--
2432
2433CREATE TRIGGER group_attributes_sutypes_update_ref
2434    AFTER INSERT OR DELETE OR UPDATE ON group_attributes_sutypes
2435    FOR EACH ROW
2436    EXECUTE PROCEDURE group_attr_update_ref();
2437
2438
2439--
2440-- Name: group_attributes_users_update_ref; Type: TRIGGER; Schema: public; Owner: -
2441--
2442
2443CREATE TRIGGER group_attributes_users_update_ref
2444    AFTER INSERT OR DELETE OR UPDATE ON group_attributes_users
2445    FOR EACH ROW
2446    EXECUTE PROCEDURE group_attr_update_ref();
2447
2448
2449--
2450-- Name: group_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2451--
2452
2453CREATE TRIGGER group_rev_tg
2454    BEFORE DELETE OR UPDATE ON "group"
2455    FOR EACH ROW
2456    EXECUTE PROCEDURE rev_tg_f();
2457
2458
2459--
2460-- Name: group_sort_field_tg; Type: TRIGGER; Schema: public; Owner: -
2461--
2462
2463CREATE TRIGGER group_sort_field_tg
2464    BEFORE INSERT OR DELETE OR UPDATE ON group_attributes_base
2465    FOR EACH ROW
2466    EXECUTE PROCEDURE group_sort_fields();
2467
2468
2469--
2470-- Name: nethost_attr_ip_update; Type: TRIGGER; Schema: public; Owner: -
2471--
2472
2473CREATE TRIGGER nethost_attr_ip_update
2474    AFTER INSERT OR DELETE OR UPDATE ON nethost_attributes_ips
2475    FOR EACH ROW
2476    EXECUTE PROCEDURE nethost_attr_update_ref();
2477
2478
2479--
2480-- Name: nethost_attr_mac_update; Type: TRIGGER; Schema: public; Owner: -
2481--
2482
2483CREATE TRIGGER nethost_attr_mac_update
2484    AFTER INSERT OR DELETE OR UPDATE ON nethost_attributes_macs
2485    FOR EACH ROW
2486    EXECUTE PROCEDURE nethost_attr_update_ref();
2487
2488
2489--
2490-- Name: nethost_attr_update; Type: TRIGGER; Schema: public; Owner: -
2491--
2492
2493CREATE TRIGGER nethost_attr_update
2494    AFTER INSERT OR DELETE OR UPDATE ON nethost_attributes
2495    FOR EACH ROW
2496    EXECUTE PROCEDURE nethost_attr_update_ref();
2497
2498
2499--
2500-- Name: nethost_attributes_users_update_ref; Type: TRIGGER; Schema: public; Owner: -
2501--
2502
2503CREATE TRIGGER nethost_attributes_users_update_ref
2504    AFTER INSERT OR DELETE OR UPDATE ON nethost_attributes_users
2505    FOR EACH ROW
2506    EXECUTE PROCEDURE nethost_attr_update_ref();
2507
2508
2509--
2510-- Name: nethost_sort_field_tg; Type: TRIGGER; Schema: public; Owner: -
2511--
2512
2513CREATE TRIGGER nethost_sort_field_tg
2514    BEFORE INSERT OR DELETE OR UPDATE ON nethost_attributes
2515    FOR EACH ROW
2516    EXECUTE PROCEDURE nethost_sort_fields();
2517
2518
2519--
2520-- Name: nethost_upd_zone_tg_del; Type: TRIGGER; Schema: public; Owner: -
2521--
2522
2523CREATE TRIGGER nethost_upd_zone_tg_del
2524    BEFORE DELETE ON nethost
2525    FOR EACH ROW
2526    EXECUTE PROCEDURE nethost_upd_zone();
2527
2528
2529--
2530-- Name: nethost_upd_zone_tg_insupd; Type: TRIGGER; Schema: public; Owner: -
2531--
2532
2533CREATE TRIGGER nethost_upd_zone_tg_insupd
2534    AFTER INSERT OR UPDATE ON nethost
2535    FOR EACH ROW
2536    EXECUTE PROCEDURE nethost_upd_zone();
2537
2538
2539--
2540-- Name: nethost_update_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2541--
2542
2543CREATE TRIGGER nethost_update_rev_tg
2544    BEFORE INSERT OR DELETE OR UPDATE ON nethost
2545    FOR EACH ROW
2546    EXECUTE PROCEDURE rev_tg_f();
2547
2548
2549--
2550-- Name: nethostipdel_upd_zone_tg; Type: TRIGGER; Schema: public; Owner: -
2551--
2552
2553CREATE TRIGGER nethostipdel_upd_zone_tg
2554    BEFORE DELETE ON nethost_attributes_ips
2555    FOR EACH ROW
2556    EXECUTE PROCEDURE nethostipdel_upd_zone();
2557
2558
2559--
2560-- Name: netzone_attr_update; Type: TRIGGER; Schema: public; Owner: -
2561--
2562
2563CREATE TRIGGER netzone_attr_update
2564    AFTER INSERT OR DELETE OR UPDATE ON netzone_attributes
2565    FOR EACH ROW
2566    EXECUTE PROCEDURE netzone_attr_update_ref();
2567
2568
2569--
2570-- Name: netzone_attr_update_ref_a_s; Type: TRIGGER; Schema: public; Owner: -
2571--
2572
2573CREATE TRIGGER netzone_attr_update_ref_a_s
2574    AFTER INSERT OR DELETE OR UPDATE ON netzone_attributes_site
2575    FOR EACH ROW
2576    EXECUTE PROCEDURE netzone_attr_update_ref();
2577
2578
2579--
2580-- Name: netzone_attr_update_ref_a_s; Type: TRIGGER; Schema: public; Owner: -
2581--
2582
2583CREATE TRIGGER netzone_attr_update_ref_a_s
2584    AFTER INSERT OR DELETE OR UPDATE ON netzone_attributes_netzone
2585    FOR EACH ROW
2586    EXECUTE PROCEDURE netzone_attr_update_ref();
2587
2588
2589--
2590-- Name: netzone_sort_fields_tg; Type: TRIGGER; Schema: public; Owner: -
2591--
2592
2593CREATE TRIGGER netzone_sort_fields_tg
2594    BEFORE INSERT OR DELETE OR UPDATE ON netzone_attributes
2595    FOR EACH ROW
2596    EXECUTE PROCEDURE netzone_sort_fields();
2597
2598
2599--
2600-- Name: netzone_update_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2601--
2602
2603CREATE TRIGGER netzone_update_rev_tg
2604    BEFORE INSERT OR DELETE OR UPDATE ON netzone
2605    FOR EACH ROW
2606    EXECUTE PROCEDURE rev_tg_f();
2607
2608
2609--
2610-- Name: person_attr_update; Type: TRIGGER; Schema: public; Owner: -
2611--
2612
2613CREATE TRIGGER person_attr_update
2614    AFTER INSERT OR DELETE OR UPDATE ON user_attributes_base
2615    FOR EACH ROW
2616    EXECUTE PROCEDURE person_attr_update_ref();
2617
2618
2619--
2620-- Name: person_attr_update_ref_a_g; Type: TRIGGER; Schema: public; Owner: -
2621--
2622
2623CREATE TRIGGER person_attr_update_ref_a_g
2624    AFTER INSERT OR DELETE OR UPDATE ON user_attributes_groups
2625    FOR EACH ROW
2626    EXECUTE PROCEDURE person_attr_update_ref();
2627
2628
2629--
2630-- Name: person_attr_update_ref_a_s; Type: TRIGGER; Schema: public; Owner: -
2631--
2632
2633CREATE TRIGGER person_attr_update_ref_a_s
2634    AFTER INSERT OR DELETE OR UPDATE ON user_attributes_site
2635    FOR EACH ROW
2636    EXECUTE PROCEDURE person_attr_update_ref();
2637
2638
2639--
2640-- Name: person_attr_update_ref_a_u; Type: TRIGGER; Schema: public; Owner: -
2641--
2642
2643CREATE TRIGGER person_attr_update_ref_a_u
2644    AFTER INSERT OR DELETE OR UPDATE ON user_attributes_users
2645    FOR EACH ROW
2646    EXECUTE PROCEDURE person_attr_update_ref();
2647
2648
2649--
2650-- Name: person_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2651--
2652
2653CREATE TRIGGER person_rev_tg
2654    BEFORE DELETE OR UPDATE ON "user"
2655    FOR EACH ROW
2656    EXECUTE PROCEDURE rev_tg_f();
2657
2658
2659--
2660-- Name: revaliases_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2661--
2662
2663CREATE TRIGGER revaliases_rev_tg
2664    BEFORE INSERT OR DELETE OR UPDATE ON revaliases
2665    FOR EACH ROW
2666    EXECUTE PROCEDURE rev_tg_f();
2667
2668
2669--
2670-- Name: revisions_rev_tg; Type: TRIGGER; Schema: public; Owner: -
2671--
2672
2673CREATE TRIGGER revisions_rev_tg
2674    AFTER DELETE OR UPDATE ON revisions
2675    FOR EACH ROW
2676    EXECUTE PROCEDURE rev_tg_f();
2677
2678
2679--
2680-- Name: settings_revision_tg; Type: TRIGGER; Schema: public; Owner: -
2681--
2682
2683CREATE TRIGGER settings_revision_tg
2684    BEFORE INSERT OR DELETE OR UPDATE ON settings
2685    FOR EACH ROW
2686    EXECUTE PROCEDURE rev_tg_f();
2687
2688
2689--
2690-- Name: site_attr_update; Type: TRIGGER; Schema: public; Owner: -
2691--
2692
2693CREATE TRIGGER site_attr_update
2694    AFTER INSERT OR DELETE OR UPDATE ON site_attributes
2695    FOR EACH ROW
2696    EXECUTE PROCEDURE site_attr_update_ref();
2697
2698
2699--
2700-- Name: update_address_site_tg; Type: TRIGGER; Schema: public; Owner: -
2701--
2702
2703CREATE TRIGGER update_address_site_tg
2704    BEFORE INSERT OR DELETE OR UPDATE ON site
2705    FOR EACH ROW
2706    EXECUTE PROCEDURE update_address_site();
2707
2708
2709--
2710-- Name: user_sort_field_tg; Type: TRIGGER; Schema: public; Owner: -
2711--
2712
2713CREATE TRIGGER user_sort_field_tg
2714    BEFORE INSERT OR DELETE OR UPDATE ON user_attributes_base
2715    FOR EACH ROW
2716    EXECUTE PROCEDURE user_sort_fields();
2717
2718
2719--
2720-- Name: accreq_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2721--
2722
2723ALTER TABLE ONLY accreq_attributes
2724    ADD CONSTRAINT accreq_attr_okey_fkey FOREIGN KEY (okey) REFERENCES accreq(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2725
2726
2727--
2728-- Name: accreq_attributes_list_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2729--
2730
2731ALTER TABLE ONLY accreq_attributes
2732    ADD CONSTRAINT accreq_attributes_list_attr_fkey FOREIGN KEY (attr) REFERENCES accreq_attributes_list(canonical);
2733
2734
2735--
2736-- Name: address_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2737--
2738
2739ALTER TABLE ONLY address_attributes_base
2740    ADD CONSTRAINT address_attr_fkey FOREIGN KEY (attr) REFERENCES address_attributes_list(canonical) ON UPDATE CASCADE;
2741
2742
2743--
2744-- Name: address_attributes_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2745--
2746
2747ALTER TABLE ONLY address_attributes_base
2748    ADD CONSTRAINT address_attributes_okey_fkey FOREIGN KEY (okey) REFERENCES address(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2749
2750
2751--
2752-- Name: address_attributes_site_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2753--
2754
2755ALTER TABLE ONLY address_attributes_site
2756    ADD CONSTRAINT address_attributes_site_attr_fkey FOREIGN KEY (attr) REFERENCES address_attributes_list_site(canonical) ON UPDATE CASCADE;
2757
2758
2759--
2760-- Name: address_attributes_site_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2761--
2762
2763ALTER TABLE ONLY address_attributes_site
2764    ADD CONSTRAINT address_attributes_site_okey_fkey FOREIGN KEY (okey) REFERENCES address(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2765
2766
2767--
2768-- Name: address_attributes_site_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2769--
2770
2771ALTER TABLE ONLY address_attributes_site
2772    ADD CONSTRAINT address_attributes_site_value_fkey FOREIGN KEY (value) REFERENCES site(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
2773
2774
2775--
2776-- Name: address_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2777--
2778
2779ALTER TABLE ONLY address
2780    ADD CONSTRAINT address_user_fkey FOREIGN KEY ("user") REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE;
2781
2782
2783--
2784-- Name: group_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2785--
2786
2787ALTER TABLE ONLY group_attributes_base
2788    ADD CONSTRAINT group_attr_fkey FOREIGN KEY (attr) REFERENCES group_attributes_list(canonical) ON UPDATE CASCADE;
2789
2790
2791--
2792-- Name: group_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2793--
2794
2795ALTER TABLE ONLY group_attributes_base
2796    ADD CONSTRAINT group_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "group"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2797
2798
2799--
2800-- Name: group_attr_sutypes_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2801--
2802
2803ALTER TABLE ONLY group_attributes_sutypes
2804    ADD CONSTRAINT group_attr_sutypes_okey_fkey FOREIGN KEY (okey) REFERENCES "group"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2805
2806
2807--
2808-- Name: group_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2809--
2810
2811ALTER TABLE ONLY group_attributes_users
2812    ADD CONSTRAINT group_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES "group"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2813
2814
2815--
2816-- Name: group_attributes_sutypes_attr; Type: FK CONSTRAINT; Schema: public; Owner: -
2817--
2818
2819ALTER TABLE ONLY group_attributes_sutypes
2820    ADD CONSTRAINT group_attributes_sutypes_attr FOREIGN KEY (attr) REFERENCES group_attributes_list(canonical) ON UPDATE CASCADE;
2821
2822
2823--
2824-- Name: group_attributes_sutypes_sutype_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2825--
2826
2827ALTER TABLE ONLY group_attributes_sutypes
2828    ADD CONSTRAINT group_attributes_sutypes_sutype_fkey FOREIGN KEY (value) REFERENCES su_type(name) ON UPDATE CASCADE ON DELETE CASCADE;
2829
2830
2831--
2832-- Name: group_attributes_users_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2833--
2834
2835ALTER TABLE ONLY group_attributes_users
2836    ADD CONSTRAINT group_attributes_users_attr_fkey FOREIGN KEY (attr) REFERENCES group_attributes_list(canonical) ON UPDATE CASCADE;
2837
2838
2839--
2840-- Name: group_attributes_users_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2841--
2842
2843ALTER TABLE ONLY group_attributes_users
2844    ADD CONSTRAINT group_attributes_users_user_fkey FOREIGN KEY (value) REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE;
2845
2846
2847--
2848-- Name: nethost_attr_ip_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2849--
2850
2851ALTER TABLE ONLY nethost_attributes_ips
2852    ADD CONSTRAINT nethost_attr_ip_fkey FOREIGN KEY (okey) REFERENCES nethost(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2853
2854
2855--
2856-- Name: nethost_attr_mac_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2857--
2858
2859ALTER TABLE ONLY nethost_attributes_macs
2860    ADD CONSTRAINT nethost_attr_mac_fkey FOREIGN KEY (okey) REFERENCES nethost(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2861
2862
2863--
2864-- Name: nethost_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2865--
2866
2867ALTER TABLE ONLY nethost_attributes
2868    ADD CONSTRAINT nethost_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES nethost(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2869
2870
2871--
2872-- Name: nethost_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2873--
2874
2875ALTER TABLE ONLY nethost_attributes_users
2876    ADD CONSTRAINT nethost_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES nethost(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2877
2878
2879--
2880-- Name: nethost_attributes_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2881--
2882
2883ALTER TABLE ONLY nethost_attributes
2884    ADD CONSTRAINT nethost_attributes_attr_fkey FOREIGN KEY (attr) REFERENCES nethost_attributes_list(canonical) ON UPDATE CASCADE;
2885
2886
2887--
2888-- Name: nethost_attributes_users_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2889--
2890
2891ALTER TABLE ONLY nethost_attributes_users
2892    ADD CONSTRAINT nethost_attributes_users_attr_fkey FOREIGN KEY (attr) REFERENCES nethost_attributes_list(canonical) ON UPDATE CASCADE;
2893
2894
2895--
2896-- Name: nethost_attributes_users_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2897--
2898
2899ALTER TABLE ONLY nethost_attributes_users
2900    ADD CONSTRAINT nethost_attributes_users_user_fkey FOREIGN KEY (value) REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE;
2901
2902
2903--
2904-- Name: netzone_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2905--
2906
2907ALTER TABLE ONLY netzone_attributes
2908    ADD CONSTRAINT netzone_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES netzone(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2909
2910
2911--
2912-- Name: netzone_attributes_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2913--
2914
2915ALTER TABLE ONLY netzone_attributes
2916    ADD CONSTRAINT netzone_attributes_attr_fkey FOREIGN KEY (attr) REFERENCES netzone_attributes_list(canonical) ON UPDATE CASCADE;
2917
2918
2919--
2920-- Name: netzone_attributes_netzone_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2921--
2922
2923ALTER TABLE ONLY netzone_attributes_netzone
2924    ADD CONSTRAINT netzone_attributes_netzone_attr_fkey FOREIGN KEY (attr) REFERENCES netzone_attributes_list(canonical) ON UPDATE CASCADE;
2925
2926
2927--
2928-- Name: netzone_attributes_netzone_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2929--
2930
2931ALTER TABLE ONLY netzone_attributes_netzone
2932    ADD CONSTRAINT netzone_attributes_netzone_okey_fkey FOREIGN KEY (okey) REFERENCES netzone(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2933
2934
2935--
2936-- Name: netzone_attributes_netzone_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2937--
2938
2939ALTER TABLE ONLY netzone_attributes_netzone
2940    ADD CONSTRAINT netzone_attributes_netzone_value_fkey FOREIGN KEY (value) REFERENCES netzone(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
2941
2942
2943--
2944-- Name: netzone_attributes_site_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2945--
2946
2947ALTER TABLE ONLY netzone_attributes_site
2948    ADD CONSTRAINT netzone_attributes_site_attr_fkey FOREIGN KEY (attr) REFERENCES netzone_attributes_list(canonical) ON UPDATE CASCADE;
2949
2950
2951--
2952-- Name: netzone_attributes_site_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2953--
2954
2955ALTER TABLE ONLY netzone_attributes_site
2956    ADD CONSTRAINT netzone_attributes_site_okey_fkey FOREIGN KEY (okey) REFERENCES netzone(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2957
2958
2959--
2960-- Name: netzone_attributes_site_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2961--
2962
2963ALTER TABLE ONLY netzone_attributes_site
2964    ADD CONSTRAINT netzone_attributes_site_value_fkey FOREIGN KEY (value) REFERENCES site(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
2965
2966
2967--
2968-- Name: revaliase_name_user_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2969--
2970
2971ALTER TABLE ONLY revaliases
2972    ADD CONSTRAINT revaliase_name_user_fkey FOREIGN KEY (name) REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE;
2973
2974
2975--
2976-- Name: site_attr_users_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2977--
2978
2979ALTER TABLE ONLY site_attributes
2980    ADD CONSTRAINT site_attr_users_okey_fkey FOREIGN KEY (okey) REFERENCES site(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2981
2982
2983--
2984-- Name: site_attributes_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2985--
2986
2987ALTER TABLE ONLY site_attributes
2988    ADD CONSTRAINT site_attributes_attr_fkey FOREIGN KEY (attr) REFERENCES site_attributes_list(canonical) ON UPDATE CASCADE;
2989
2990
2991--
2992-- Name: user_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
2993--
2994
2995ALTER TABLE ONLY user_attributes_base
2996    ADD CONSTRAINT user_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "user"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
2997
2998
2999--
3000-- Name: user_attributes_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3001--
3002
3003ALTER TABLE ONLY user_attributes_base
3004    ADD CONSTRAINT user_attributes_attr_fkey FOREIGN KEY (attr) REFERENCES user_attributes_list(canonical) ON UPDATE CASCADE;
3005
3006
3007--
3008-- Name: user_attributes_groups_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3009--
3010
3011ALTER TABLE ONLY user_attributes_groups
3012    ADD CONSTRAINT user_attributes_groups_attr_fkey FOREIGN KEY (attr) REFERENCES user_attributes_list(canonical) ON UPDATE CASCADE;
3013
3014
3015--
3016-- Name: user_attributes_groups_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3017--
3018
3019ALTER TABLE ONLY user_attributes_groups
3020    ADD CONSTRAINT user_attributes_groups_value_fkey FOREIGN KEY (value) REFERENCES "group"(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
3021
3022
3023--
3024-- Name: user_attributes_site_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3025--
3026
3027ALTER TABLE ONLY user_attributes_site
3028    ADD CONSTRAINT user_attributes_site_attr_fkey FOREIGN KEY (attr) REFERENCES user_attributes_list(canonical) ON UPDATE CASCADE;
3029
3030
3031--
3032-- Name: user_attributes_site_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3033--
3034
3035ALTER TABLE ONLY user_attributes_site
3036    ADD CONSTRAINT user_attributes_site_value_fkey FOREIGN KEY (value) REFERENCES site(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
3037
3038
3039--
3040-- Name: user_attributes_users_attr_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3041--
3042
3043ALTER TABLE ONLY user_attributes_users
3044    ADD CONSTRAINT user_attributes_users_attr_fkey FOREIGN KEY (attr) REFERENCES user_attributes_list(canonical) ON UPDATE CASCADE;
3045
3046
3047--
3048-- Name: user_attributes_users_value_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3049--
3050
3051ALTER TABLE ONLY user_attributes_users
3052    ADD CONSTRAINT user_attributes_users_value_fkey FOREIGN KEY (value) REFERENCES "user"(name) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
3053
3054
3055--
3056-- Name: user_site_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3057--
3058
3059ALTER TABLE ONLY user_attributes_site
3060    ADD CONSTRAINT user_site_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "user"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
3061
3062
3063--
3064-- Name: user_users_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3065--
3066
3067ALTER TABLE ONLY user_attributes_users
3068    ADD CONSTRAINT user_users_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "user"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
3069
3070
3071--
3072-- Name: user_users_attr_okey_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
3073--
3074
3075ALTER TABLE ONLY user_attributes_groups
3076    ADD CONSTRAINT user_users_attr_okey_fkey FOREIGN KEY (okey) REFERENCES "user"(ikey) ON UPDATE CASCADE ON DELETE CASCADE;
3077
3078
3079--
3080-- PostgreSQL database dump complete
3081--
3082
Note: See TracBrowser for help on using the repository browser.