root/wifidogadmin/sql/wifidog-postgres-schema.sql

Revision 479, 51.0 kB (checked in by insultant, 8 months ago)

--

Line 
1 --
2 -- PostgreSQL database dump
3 --
4
5 SET client_encoding = 'UTF8';
6 SET standard_conforming_strings = off;
7 SET check_function_bodies = false;
8 SET client_min_messages = warning;
9 SET escape_string_warning = off;
10
11 --
12 -- Name: wifidog; Type: DATABASE; Schema: -; Owner: -
13 --
14
15 CREATE DATABASE wifidog WITH TEMPLATE = template0 ENCODING = 'UTF8';
16
17
18 \connect wifidog
19
20 SET client_encoding = 'UTF8';
21 SET standard_conforming_strings = off;
22 SET check_function_bodies = false;
23 SET client_min_messages = warning;
24 SET escape_string_warning = off;
25
26 --
27 -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
28 --
29
30 COMMENT ON SCHEMA public IS 'Standard public schema';
31
32
33 --
34 -- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: -
35 --
36
37 CREATE PROCEDURAL LANGUAGE plpgsql;
38
39
40 SET search_path = public, pg_catalog;
41
42 SET default_tablespace = '';
43
44 SET default_with_oids = true;
45
46 --
47 -- Name: connections; Type: TABLE; Schema: public; Owner: -; Tablespace:
48 --
49
50 CREATE TABLE connections (
51     conn_id integer NOT NULL,
52     token character varying(32) DEFAULT ''::character varying NOT NULL,
53     token_status character varying(10) DEFAULT 'UNUSED'::character varying NOT NULL,
54     timestamp_in timestamp without time zone,
55     node_id character varying(32),
56     node_ip character varying(15),
57     timestamp_out timestamp without time zone,
58     user_id character varying(45) DEFAULT ''::character varying NOT NULL,
59     user_mac character varying(18),
60     user_ip character varying(16),
61     last_updated timestamp without time zone NOT NULL,
62     incoming bigint,
63     outgoing bigint
64 );
65
66
67 --
68 -- Name: connections_conn_id_seq; Type: SEQUENCE; Schema: public; Owner: -
69 --
70
71 CREATE SEQUENCE connections_conn_id_seq
72     INCREMENT BY 1
73     NO MAXVALUE
74     NO MINVALUE
75     CACHE 1;
76
77
78 --
79 -- Name: connections_conn_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
80 --
81
82 ALTER SEQUENCE connections_conn_id_seq OWNED BY connections.conn_id;
83
84
85 --
86 -- Name: content; Type: TABLE; Schema: public; Owner: -; Tablespace:
87 --
88
89 CREATE TABLE content (
90     content_id text NOT NULL,
91     content_type text NOT NULL,
92     title text,
93     description text,
94     project_info text,
95     creation_timestamp timestamp without time zone DEFAULT now(),
96     is_persistent boolean DEFAULT false,
97     long_description text,
98     title_is_displayed boolean DEFAULT true NOT NULL,
99     last_update_timestamp timestamp without time zone DEFAULT now() NOT NULL,
100     CONSTRAINT content_type_not_empty_string CHECK ((content_type <> ''::text))
101 );
102
103
104 --
105 -- Name: content_available_display_areas; Type: TABLE; Schema: public; Owner: -; Tablespace:
106 --
107
108 CREATE TABLE content_available_display_areas (
109     display_area text NOT NULL
110 );
111
112
113 --
114 -- Name: content_available_display_pages; Type: TABLE; Schema: public; Owner: -; Tablespace:
115 --
116
117 CREATE TABLE content_available_display_pages (
118     display_page text NOT NULL
119 );
120
121
122 SET default_with_oids = false;
123
124 --
125 -- Name: content_clickthrough_log; Type: TABLE; Schema: public; Owner: -; Tablespace:
126 --
127
128 CREATE TABLE content_clickthrough_log (
129     user_id text NOT NULL,
130     content_id text NOT NULL,
131     first_clickthrough_timestamp timestamp without time zone DEFAULT now() NOT NULL,
132     node_id text NOT NULL,
133     destination_url text NOT NULL,
134     num_clickthrough integer DEFAULT 1 NOT NULL,
135     last_clickthrough_timestamp timestamp without time zone DEFAULT now() NOT NULL,
136     CONSTRAINT content_clickthrough_log_destination_url_check CHECK ((destination_url <> ''::text))
137 );
138
139
140 SET default_with_oids = true;
141
142 --
143 -- Name: content_display_log; Type: TABLE; Schema: public; Owner: -; Tablespace:
144 --
145
146 CREATE TABLE content_display_log (
147     user_id text NOT NULL,
148     content_id text NOT NULL,
149     first_display_timestamp timestamp without time zone DEFAULT now() NOT NULL,
150     node_id text NOT NULL,
151     last_display_timestamp timestamp without time zone DEFAULT now() NOT NULL,
152     num_display integer DEFAULT 1 NOT NULL
153 );
154
155
156 --
157 -- Name: content_embedded_content; Type: TABLE; Schema: public; Owner: -; Tablespace:
158 --
159
160 CREATE TABLE content_embedded_content (
161     embedded_content_id text NOT NULL,
162     embedded_file_id text,
163     fallback_content_id text,
164     parameters text,
165     attributes text
166 );
167
168
169 --
170 -- Name: content_file; Type: TABLE; Schema: public; Owner: -; Tablespace:
171 --
172
173 CREATE TABLE content_file (
174     files_id text NOT NULL,
175     filename text,
176     mime_type text,
177     remote_size bigint,
178     url text,
179     data_blob oid,
180     local_binary_size bigint
181 );
182
183
184 --
185 -- Name: content_file_image; Type: TABLE; Schema: public; Owner: -; Tablespace:
186 --
187
188 CREATE TABLE content_file_image (
189     pictures_id text NOT NULL,
190     width integer,
191     height integer,
192     hyperlink_url text
193 );
194
195
196 --
197 -- Name: content_flickr_photostream; Type: TABLE; Schema: public; Owner: -; Tablespace:
198 --
199
200 CREATE TABLE content_flickr_photostream (
201     flickr_photostream_id text NOT NULL,
202     api_key text,
203     photo_selection_mode text DEFAULT 'PSM_GROUP'::text NOT NULL,
204     user_id text,
205     user_name text,
206     tags text,
207     tag_mode character varying(10) DEFAULT 'any'::character varying,
208     group_id text,
209     random boolean DEFAULT true NOT NULL,
210     min_taken_date timestamp without time zone,
211     max_taken_date timestamp without time zone,
212     photo_batch_size integer DEFAULT 10,
213     photo_count integer DEFAULT 1,
214     display_title boolean DEFAULT true NOT NULL,
215     display_description boolean DEFAULT false NOT NULL,
216     display_tags boolean DEFAULT false NOT NULL,
217     preferred_size text,
218     requests_cache text,
219     cache_update_timestamp timestamp without time zone,
220     api_shared_secret text,
221     photo_display_mode text DEFAULT 'PDM_GRID'::text NOT NULL
222 );
223
224
225 --
226 -- Name: content_group; Type: TABLE; Schema: public; Owner: -; Tablespace:
227 --
228
229 CREATE TABLE content_group (
230     content_group_id text NOT NULL,
231     content_changes_on_mode text DEFAULT 'ALWAYS'::text NOT NULL,
232     content_ordering_mode text DEFAULT 'RANDOM'::text NOT NULL,
233     display_num_elements integer DEFAULT 1 NOT NULL,
234     allow_repeat text DEFAULT 'YES'::text NOT NULL,
235     CONSTRAINT display_at_least_one_element CHECK ((display_num_elements > 0))
236 );
237
238
239 --
240 -- Name: content_group_element; Type: TABLE; Schema: public; Owner: -; Tablespace:
241 --
242
243 CREATE TABLE content_group_element (
244     content_group_element_id text NOT NULL,
245     content_group_id text NOT NULL,
246     display_order integer DEFAULT 1,
247     displayed_content_id text,
248     force_only_allowed_node boolean,
249     valid_from_timestamp timestamp without time zone,
250     valid_until_timestamp timestamp without time zone
251 );
252
253
254 --
255 -- Name: content_group_element_has_allowed_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
256 --
257
258 CREATE TABLE content_group_element_has_allowed_nodes (
259     content_group_element_id text NOT NULL,
260     node_id text NOT NULL,
261     allowed_since timestamp without time zone DEFAULT now()
262 );
263
264
265 --
266 -- Name: content_has_owners; Type: TABLE; Schema: public; Owner: -; Tablespace:
267 --
268
269 CREATE TABLE content_has_owners (
270     content_id text NOT NULL,
271     user_id text NOT NULL,
272     is_author boolean DEFAULT false NOT NULL,
273     owner_since timestamp without time zone DEFAULT now()
274 );
275
276
277 --
278 -- Name: content_iframe; Type: TABLE; Schema: public; Owner: -; Tablespace:
279 --
280
281 CREATE TABLE content_iframe (
282     iframes_id text NOT NULL,
283     url text,
284     width integer,
285     height integer
286 );
287
288
289 SET default_with_oids = false;
290
291 --
292 -- Name: content_key_value_pairs; Type: TABLE; Schema: public; Owner: -; Tablespace:
293 --
294
295 CREATE TABLE content_key_value_pairs (
296     content_id text NOT NULL,
297     "key" text NOT NULL,
298     value text
299 );
300
301
302 SET default_with_oids = true;
303
304 --
305 -- Name: content_langstring_entries; Type: TABLE; Schema: public; Owner: -; Tablespace:
306 --
307
308 CREATE TABLE content_langstring_entries (
309     langstring_entries_id text NOT NULL,
310     langstrings_id text,
311     locales_id text,
312     value text DEFAULT ''::text
313 );
314
315
316 --
317 -- Name: content_rss_aggregator; Type: TABLE; Schema: public; Owner: -; Tablespace:
318 --
319
320 CREATE TABLE content_rss_aggregator (
321     content_id text NOT NULL,
322     number_of_display_items integer DEFAULT 10 NOT NULL,
323     algorithm_strength real DEFAULT 0.75 NOT NULL,
324     max_item_age interval,
325     feed_expansion text DEFAULT 'FIRST'::text NOT NULL,
326     feed_ordering text DEFAULT 'REVERSE_DATE'::text NOT NULL,
327     display_empty_feeds boolean DEFAULT true NOT NULL
328 );
329
330
331 --
332 -- Name: content_rss_aggregator_feeds; Type: TABLE; Schema: public; Owner: -; Tablespace:
333 --
334
335 CREATE TABLE content_rss_aggregator_feeds (
336     content_id text NOT NULL,
337     url text NOT NULL,
338     bias real DEFAULT 1 NOT NULL,
339     default_publication_interval integer,
340     title text
341 );
342
343
344 SET default_with_oids = false;
345
346 --
347 -- Name: content_shoutbox_messages; Type: TABLE; Schema: public; Owner: -; Tablespace:
348 --
349
350 CREATE TABLE content_shoutbox_messages (
351     message_content_id text NOT NULL,
352     shoutbox_id text NOT NULL,
353     origin_node_id text NOT NULL,
354     author_user_id text NOT NULL,
355     creation_date timestamp without time zone DEFAULT now()
356 );
357
358
359 --
360 -- Name: content_type_filters; Type: TABLE; Schema: public; Owner: -; Tablespace:
361 --
362
363 CREATE TABLE content_type_filters (
364     content_type_filter_id text NOT NULL,
365     content_type_filter_label text,
366     content_type_filter_rules text NOT NULL,
367     CONSTRAINT content_type_filter_rules_not_empty_string CHECK ((content_type_filter_rules <> ''::text))
368 );
369
370
371 SET default_with_oids = true;
372
373 --
374 -- Name: locales; Type: TABLE; Schema: public; Owner: -; Tablespace:
375 --
376
377 CREATE TABLE locales (
378     locales_id text NOT NULL
379 );
380
381
382 --
383 -- Name: network_has_content; Type: TABLE; Schema: public; Owner: -; Tablespace:
384 --
385
386 CREATE TABLE network_has_content (
387     network_id text NOT NULL,
388     content_id text NOT NULL,
389     subscribe_timestamp timestamp without time zone DEFAULT now() NOT NULL,
390     display_page text DEFAULT 'portal'::text NOT NULL,
391     display_area text DEFAULT 'main_area_middle'::text NOT NULL,
392     display_order integer DEFAULT 1 NOT NULL
393 );
394
395
396 SET default_with_oids = false;
397
398 --
399 -- Name: network_has_profile_templates; Type: TABLE; Schema: public; Owner: -; Tablespace:
400 --
401
402 CREATE TABLE network_has_profile_templates (
403     network_id text NOT NULL,
404     profile_template_id text NOT NULL
405 );
406
407
408 --
409 -- Name: stakeholders; Type: TABLE; Schema: public; Owner: -; Tablespace:
410 --
411
412 CREATE TABLE stakeholders (
413     user_id text NOT NULL,
414     role_id text NOT NULL,
415     object_id text NOT NULL,
416     CONSTRAINT user_has_roles_objct_id_not_empty_string CHECK ((object_id <> ''::text))
417 );
418
419
420 --
421 -- Name: network_stakeholders; Type: TABLE; Schema: public; Owner: -; Tablespace:
422 --
423
424 CREATE TABLE network_stakeholders (
425 )
426 INHERITS (stakeholders);
427
428
429 SET default_with_oids = true;
430
431 --
432 -- Name: networks; Type: TABLE; Schema: public; Owner: -; Tablespace:
433 --
434
435 CREATE TABLE networks (
436     network_id text NOT NULL,
437     network_authenticator_class text NOT NULL,
438     network_authenticator_params text,
439     name text DEFAULT 'Unnamed network'::text NOT NULL,
440     creation_date date DEFAULT now() NOT NULL,
441     homepage_url text,
442     tech_support_email text,
443     validation_grace_time interval DEFAULT '00:20:00'::interval NOT NULL,
444     validation_email_from_address text DEFAULT 'validation@wifidognetwork'::text NOT NULL,
445     allow_multiple_login boolean DEFAULT false NOT NULL,
446     allow_splash_only_nodes boolean DEFAULT false NOT NULL,
447     allow_custom_portal_redirect boolean DEFAULT false NOT NULL,
448     gmaps_initial_latitude numeric(16,6),
449     gmaps_initial_longitude numeric(16,6),
450     gmaps_initial_zoom_level integer,
451     gmaps_map_type text DEFAULT 'G_NORMAL_MAP'::text NOT NULL,
452     theme_pack text,
453     CONSTRAINT networks_gmaps_map_type CHECK ((gmaps_map_type <> ''::text)),
454     CONSTRAINT networks_name CHECK ((name <> ''::text)),
455     CONSTRAINT networks_network_authenticator_class CHECK ((network_authenticator_class <> ''::text)),
456     CONSTRAINT networks_validation_email_from_address CHECK ((validation_email_from_address <> ''::text))
457 );
458
459
460 SET default_with_oids = false;
461
462 --
463 -- Name: node_deployment_status; Type: TABLE; Schema: public; Owner: -; Tablespace:
464 --
465
466 CREATE TABLE node_deployment_status (
467     node_deployment_status character varying(32) NOT NULL
468 );
469
470
471 SET default_with_oids = true;
472
473 --
474 -- Name: node_has_content; Type: TABLE; Schema: public; Owner: -; Tablespace:
475 --
476
477 CREATE TABLE node_has_content (
478     node_id text NOT NULL,
479     content_id text NOT NULL,
480     subscribe_timestamp timestamp without time zone DEFAULT now() NOT NULL,
481     display_page text DEFAULT 'portal'::text NOT NULL,
482     display_area text DEFAULT 'main_area_middle'::text NOT NULL,
483     display_order integer DEFAULT 1 NOT NULL
484 );
485
486
487 SET default_with_oids = false;
488
489 --
490 -- Name: node_stakeholders; Type: TABLE; Schema: public; Owner: -; Tablespace:
491 --
492
493 CREATE TABLE node_stakeholders (
494 )
495 INHERITS (stakeholders);
496
497
498 SET default_with_oids = true;
499
500 --
501 -- Name: nodes; Type: TABLE; Schema: public; Owner: -; Tablespace:
502 --
503
504 CREATE TABLE nodes (
505     node_id character varying(32) DEFAULT ''::character varying NOT NULL,
506     name text,
507     last_heartbeat_ip character varying(16),
508     last_heartbeat_timestamp timestamp without time zone DEFAULT now(),
509     creation_date date DEFAULT now(),
510     home_page_url text,
511     last_heartbeat_user_agent text,
512     description text,
513     map_url text,
514     public_phone_number text,
515     public_email text,
516     mass_transit_info text,
517     node_deployment_status character varying(32) DEFAULT 'IN_PLANNING'::character varying NOT NULL,
518     venue_type text DEFAULT 'Other'::text,
519     max_monthly_incoming bigint,
520     max_monthly_outgoing bigint,
521     quota_reset_day_of_month integer,
522     latitude numeric(16,6),
523     longitude numeric(16,6),
524     civic_number text,
525     street_name text,
526     city text,
527     province text,
528     country text,
529     postal_code text,
530     network_id text NOT NULL,
531     last_paged timestamp without time zone,
532     is_splash_only_node boolean DEFAULT false,
533     custom_portal_redirect_url text,
534     gw_id text NOT NULL,
535     last_heartbeat_sys_uptime integer,
536     last_heartbeat_wifidog_uptime integer,
537     last_heartbeat_sys_memfree integer,
538     last_heartbeat_sys_load real
539 );
540
541
542 SET default_with_oids = false;
543
544 --
545 -- Name: permissions; Type: TABLE; Schema: public; Owner: -; Tablespace:
546 --
547
548 CREATE TABLE permissions (
549     permission_id text NOT NULL,
550     stakeholder_type_id text NOT NULL,
551     CONSTRAINT permission_rules_id_not_empty_string CHECK ((permission_id <> ''::text))
552 );
553
554
555 --
556 -- Name: profile_fields; Type: TABLE; Schema: public; Owner: -; Tablespace:
557 --
558
559 CREATE TABLE profile_fields (
560     profile_field_id text NOT NULL,
561     profile_id text,
562     profile_template_field_id text,
563     content_id text,
564     last_modified timestamp without time zone DEFAULT now()
565 );
566
567
568 --
569 -- Name: profile_template_fields; Type: TABLE; Schema: public; Owner: -; Tablespace:
570 --
571
572 CREATE TABLE profile_template_fields (
573     profile_template_field_id text NOT NULL,
574     profile_template_id text NOT NULL,
575     display_label_content_id text,
576     admin_label_content_id text,
577     content_type_filter_id text,
578     display_order integer DEFAULT 1,
579     semantic_id text
580 );
581
582
583 --
584 -- Name: profile_templates; Type: TABLE; Schema: public; Owner: -; Tablespace:
585 --
586
587 CREATE TABLE profile_templates (
588     profile_template_id text NOT NULL,
589     profile_template_label text,
590     creation_date timestamp without time zone DEFAULT now()
591 );
592
593
594 --
595 -- Name: profiles; Type: TABLE; Schema: public; Owner: -; Tablespace:
596 --
597
598 CREATE TABLE profiles (
599     profile_id text NOT NULL,
600     profile_template_id text,
601     creation_date timestamp without time zone DEFAULT now(),
602     is_visible boolean DEFAULT true
603 );
604
605
606 --
607 -- Name: role_has_permissions; Type: TABLE; Schema: public; Owner: -; Tablespace:
608 --
609
610 CREATE TABLE role_has_permissions (
611     role_id text NOT NULL,
612     permission_id text NOT NULL
613 );
614
615
616 --
617 -- Name: roles; Type: TABLE; Schema: public; Owner: -; Tablespace:
618 --
619
620 CREATE TABLE roles (
621     role_id text NOT NULL,
622     role_description_content_id text,
623     is_system_role boolean DEFAULT false NOT NULL,
624     stakeholder_type_id text NOT NULL,
625     role_creation_date timestamp without time zone DEFAULT now(),
626     CONSTRAINT roles_rules_id_not_empty_string CHECK ((role_id <> ''::text))
627 );
628
629
630 SET default_with_oids = true;
631
632 --
633 -- Name: schema_info; Type: TABLE; Schema: public; Owner: -; Tablespace:
634 --
635
636 CREATE TABLE schema_info (
637     tag text NOT NULL,
638     value text
639 );
640
641
642 SET default_with_oids = false;
643
644 --
645 -- Name: server; Type: TABLE; Schema: public; Owner: -; Tablespace:
646 --
647
648 CREATE TABLE server (
649     server_id text NOT NULL,
650     creation_date date DEFAULT now() NOT NULL,
651     default_virtual_host text NOT NULL
652 );
653
654
655 --
656 -- Name: server_stakeholders; Type: TABLE; Schema: public; Owner: -; Tablespace:
657 --
658
659 CREATE TABLE server_stakeholders (
660 )
661 INHERITS (stakeholders);
662
663
664 --
665 -- Name: stakeholder_types; Type: TABLE; Schema: public; Owner: -; Tablespace:
666 --
667
668 CREATE TABLE stakeholder_types (
669     stakeholder_type_id text NOT NULL,
670     CONSTRAINT stakeholder_types_id_not_empty_string CHECK ((stakeholder_type_id <> ''::text))
671 );
672
673
674 SET default_with_oids = true;
675
676 --
677 -- Name: token_status; Type: TABLE; Schema: public; Owner: -; Tablespace:
678 --
679
680 CREATE TABLE token_status (
681     token_status character varying(10) NOT NULL
682 );
683
684
685 --
686 -- Name: user_has_content; Type: TABLE; Schema: public; Owner: -; Tablespace:
687 --
688
689 CREATE TABLE user_has_content (
690     user_id text NOT NULL,
691     content_id text NOT NULL,
692     subscribe_timestamp timestamp without time zone DEFAULT now() NOT NULL
693 );
694
695
696 SET default_with_oids = false;
697
698 --
699 -- Name: user_has_profiles; Type: TABLE; Schema: public; Owner: -; Tablespace:
700 --
701
702 CREATE TABLE user_has_profiles (
703     user_id text NOT NULL,
704     profile_id text NOT NULL
705 );
706
707
708 SET default_with_oids = true;
709
710 --
711 -- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
712 --
713
714 CREATE TABLE users (
715     user_id character varying(45) NOT NULL,
716     pass character varying(32) DEFAULT ''::character varying NOT NULL,
717     email character varying(255) DEFAULT ''::character varying NOT NULL,
718     account_status integer,
719     validation_token character varying(64) DEFAULT ''::character varying NOT NULL,
720     reg_date timestamp without time zone DEFAULT now() NOT NULL,
721     username text,
722     account_origin text NOT NULL,
723     never_show_username boolean DEFAULT false,
724     prefered_locale text,
725     CONSTRAINT check_user_not_empty CHECK (((user_id)::text <> ''::text))
726 );
727
728
729 SET default_with_oids = false;
730
731 --
732 -- Name: venue_types; Type: TABLE; Schema: public; Owner: -; Tablespace:
733 --
734
735 CREATE TABLE venue_types (
736     venue_type text NOT NULL
737 );
738
739
740 --
741 -- Name: venues; Type: TABLE; Schema: public; Owner: -; Tablespace:
742 --
743
744 CREATE TABLE venues (
745     name text NOT NULL,
746     description text
747 );
748
749
750 --
751 -- Name: virtual_hosts; Type: TABLE; Schema: public; Owner: -; Tablespace:
752 --
753
754 CREATE TABLE virtual_hosts (
755     virtual_host_id text NOT NULL,
756     hostname text NOT NULL,
757     creation_date date DEFAULT now() NOT NULL,
758     ssl_available boolean DEFAULT false NOT NULL,
759     gmaps_api_key text,
760     default_network text NOT NULL,
761     CONSTRAINT virtual_hosts_hostname_check CHECK ((hostname <> ''::text))
762 );
763
764
765 --
766 -- Name: conn_id; Type: DEFAULT; Schema: public; Owner: -
767 --
768
769 ALTER TABLE connections ALTER COLUMN conn_id SET DEFAULT nextval('connections_conn_id_seq'::regclass);
770
771
772 --
773 -- Name: connections_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
774 --
775
776 ALTER TABLE ONLY connections
777     ADD CONSTRAINT connections_pkey PRIMARY KEY (conn_id);
778
779
780 --
781 -- Name: content_available_display_areas_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
782 --
783
784 ALTER TABLE ONLY content_available_display_areas
785     ADD CONSTRAINT content_available_display_areas_pkey PRIMARY KEY (display_area);
786
787
788 --
789 -- Name: content_clickthrough_log_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
790 --
791
792 ALTER TABLE ONLY content_clickthrough_log
793     ADD CONSTRAINT content_clickthrough_log_pkey PRIMARY KEY (content_id, user_id, node_id, destination_url);
794
795
796 --
797 -- Name: content_display_location_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
798 --
799
800 ALTER TABLE ONLY content_available_display_pages
801     ADD CONSTRAINT content_display_location_pkey PRIMARY KEY (display_page);
802
803
804 --
805 -- Name: content_display_log_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
806 --
807
808 ALTER TABLE ONLY content_display_log
809     ADD CONSTRAINT content_display_log_pkey PRIMARY KEY (content_id, user_id, node_id);
810
811
812 --
813 -- Name: content_group_element_has_allowed_nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
814 --
815
816 ALTER TABLE ONLY content_group_element_has_allowed_nodes
817     ADD CONSTRAINT content_group_element_has_allowed_nodes_pkey PRIMARY KEY (content_group_element_id, node_id);
818
819
820 --
821 -- Name: content_group_element_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
822 --
823
824 ALTER TABLE ONLY content_group_element
825     ADD CONSTRAINT content_group_element_pkey PRIMARY KEY (content_group_element_id);
826
827
828 --
829 -- Name: content_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
830 --
831
832 ALTER TABLE ONLY content_group
833     ADD CONSTRAINT content_group_pkey PRIMARY KEY (content_group_id);
834
835
836 --
837 -- Name: content_has_owners_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
838 --
839
840 ALTER TABLE ONLY content_has_owners
841     ADD CONSTRAINT content_has_owners_pkey PRIMARY KEY (content_id, user_id);
842
843
844 --
845 -- Name: content_key_value_pairs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
846 --
847
848 ALTER TABLE ONLY content_key_value_pairs
849     ADD CONSTRAINT content_key_value_pairs_pkey PRIMARY KEY (content_id, "key");
850
851
852 --
853 -- Name: content_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
854 --
855
856 ALTER TABLE ONLY content
857     ADD CONSTRAINT content_pkey PRIMARY KEY (content_id);
858
859
860 --
861 -- Name: content_rss_aggregator_feeds_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
862 --
863
864 ALTER TABLE ONLY content_rss_aggregator_feeds
865     ADD CONSTRAINT content_rss_aggregator_feeds_pkey PRIMARY KEY (content_id, url);
866
867
868 --
869 -- Name: content_rss_aggregator_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
870 --
871
872 ALTER TABLE ONLY content_rss_aggregator
873     ADD CONSTRAINT content_rss_aggregator_pkey PRIMARY KEY (content_id);
874
875
876 --
877 -- Name: content_shoutbox_messages_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
878 --
879
880 ALTER TABLE ONLY content_shoutbox_messages
881     ADD CONSTRAINT content_shoutbox_messages_pkey PRIMARY KEY (message_content_id);
882
883
884 --
885 -- Name: content_type_filters_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
886 --
887
888 ALTER TABLE ONLY content_type_filters
889     ADD CONSTRAINT content_type_filters_pkey PRIMARY KEY (content_type_filter_id);
890
891
892 --
893 -- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
894 --
895
896 ALTER TABLE ONLY content_file
897     ADD CONSTRAINT files_pkey PRIMARY KEY (files_id);
898
899
900 --
901 -- Name: flickr_photostream_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
902 --
903
904 ALTER TABLE ONLY content_flickr_photostream
905     ADD CONSTRAINT flickr_photostream_pkey PRIMARY KEY (flickr_photostream_id);
906
907
908 --
909 -- Name: iframes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
910 --
911
912 ALTER TABLE ONLY content_iframe
913     ADD CONSTRAINT iframes_pkey PRIMARY KEY (iframes_id);
914
915
916 --
917 -- Name: langstring_entries_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
918 --
919
920 ALTER TABLE ONLY content_langstring_entries
921     ADD CONSTRAINT langstring_entries_pkey PRIMARY KEY (langstring_entries_id);
922
923
924 --
925 -- Name: locales_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
926 --
927
928 ALTER TABLE ONLY locales
929     ADD CONSTRAINT locales_pkey PRIMARY KEY (locales_id);
930
931
932 --
933 -- Name: network_has_content_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
934 --
935
936 ALTER TABLE ONLY network_has_content
937     ADD CONSTRAINT network_has_content_pkey PRIMARY KEY (network_id, content_id);
938
939
940 --
941 -- Name: network_has_profile_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
942 --
943
944 ALTER TABLE ONLY network_has_profile_templates
945     ADD CONSTRAINT network_has_profile_templates_pkey PRIMARY KEY (network_id, profile_template_id);
946
947
948 --
949 -- Name: network_stakeholders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
950 --
951
952 ALTER TABLE ONLY network_stakeholders
953     ADD CONSTRAINT network_stakeholders_pkey PRIMARY KEY (user_id, role_id, object_id);
954
955
956 --
957 -- Name: networks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
958 --
959
960 ALTER TABLE ONLY networks
961     ADD CONSTRAINT networks_pkey PRIMARY KEY (network_id);
962
963
964 --
965 -- Name: node_deployment_status_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
966 --
967
968 ALTER TABLE ONLY node_deployment_status
969     ADD CONSTRAINT node_deployment_status_pkey PRIMARY KEY (node_deployment_status);
970
971
972 --
973 -- Name: node_has_content_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
974 --
975
976 ALTER TABLE ONLY node_has_content
977     ADD CONSTRAINT node_has_content_pkey PRIMARY KEY (node_id, content_id);
978
979
980 --
981 -- Name: node_stakeholders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
982 --
983
984 ALTER TABLE ONLY node_stakeholders
985     ADD CONSTRAINT node_stakeholders_pkey PRIMARY KEY (user_id, role_id, object_id);
986
987
988 --
989 -- Name: nodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
990 --
991
992 ALTER TABLE ONLY nodes
993     ADD CONSTRAINT nodes_pkey PRIMARY KEY (node_id);
994
995
996 --
997 -- Name: permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
998 --
999
1000 ALTER TABLE ONLY permissions
1001     ADD CONSTRAINT permissions_pkey PRIMARY KEY (permission_id);
1002
1003
1004 --
1005 -- Name: pictures_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1006 --
1007
1008 ALTER TABLE ONLY content_file_image
1009     ADD CONSTRAINT pictures_pkey PRIMARY KEY (pictures_id);
1010
1011
1012 --
1013 -- Name: profile_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1014 --
1015
1016 ALTER TABLE ONLY profile_fields
1017     ADD CONSTRAINT profile_fields_pkey PRIMARY KEY (profile_field_id);
1018
1019
1020 --
1021 -- Name: profile_template_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1022 --
1023
1024 ALTER TABLE ONLY profile_template_fields
1025     ADD CONSTRAINT profile_template_fields_pkey PRIMARY KEY (profile_template_field_id);
1026
1027
1028 --
1029 -- Name: profile_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1030 --
1031
1032 ALTER TABLE ONLY profile_templates
1033     ADD CONSTRAINT profile_templates_pkey PRIMARY KEY (profile_template_id);
1034
1035
1036 --
1037 -- Name: profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1038 --
1039
1040 ALTER TABLE ONLY profiles
1041     ADD CONSTRAINT profiles_pkey PRIMARY KEY (profile_id);
1042
1043
1044 --
1045 -- Name: role_has_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1046 --
1047
1048 ALTER TABLE ONLY role_has_permissions
1049     ADD CONSTRAINT role_has_permissions_pkey PRIMARY KEY (role_id, permission_id);
1050
1051
1052 --
1053 -- Name: roles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1054 --
1055
1056 ALTER TABLE ONLY roles
1057     ADD CONSTRAINT roles_pkey PRIMARY KEY (role_id);
1058
1059
1060 --
1061 -- Name: schema_info_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1062 --
1063
1064 ALTER TABLE ONLY schema_info
1065     ADD CONSTRAINT schema_info_pkey PRIMARY KEY (tag);
1066
1067
1068 --
1069 -- Name: server_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1070 --
1071
1072 ALTER TABLE ONLY server
1073     ADD CONSTRAINT server_pkey PRIMARY KEY (server_id);
1074
1075
1076 --
1077 -- Name: server_stakeholders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1078 --
1079
1080 ALTER TABLE ONLY server_stakeholders
1081     ADD CONSTRAINT server_stakeholders_pkey PRIMARY KEY (user_id, role_id, object_id);
1082
1083
1084 --
1085 -- Name: stakeholder_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1086 --
1087
1088 ALTER TABLE ONLY stakeholder_types
1089     ADD CONSTRAINT stakeholder_types_pkey PRIMARY KEY (stakeholder_type_id);
1090
1091
1092 --
1093 -- Name: stakeholders_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1094 --
1095
1096 ALTER TABLE ONLY stakeholders
1097     ADD CONSTRAINT stakeholders_pkey PRIMARY KEY (user_id, role_id, object_id);
1098
1099
1100 --
1101 -- Name: token_status_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1102 --
1103
1104 ALTER TABLE ONLY token_status
1105     ADD CONSTRAINT token_status_pkey PRIMARY KEY (token_status);
1106
1107
1108 --
1109 -- Name: user_has_content_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1110 --
1111
1112 ALTER TABLE ONLY user_has_content
1113     ADD CONSTRAINT user_has_content_pkey PRIMARY KEY (user_id, content_id);
1114
1115
1116 --
1117 -- Name: user_has_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1118 --
1119
1120 ALTER TABLE ONLY user_has_profiles
1121     ADD CONSTRAINT user_has_profiles_pkey PRIMARY KEY (user_id, profile_id);
1122
1123
1124 --
1125 -- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1126 --
1127
1128 ALTER TABLE ONLY users
1129     ADD CONSTRAINT users_pkey PRIMARY KEY (user_id);
1130
1131
1132 --
1133 -- Name: venue_types_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1134 --
1135
1136 ALTER TABLE ONLY venue_types
1137     ADD CONSTRAINT venue_types_pkey PRIMARY KEY (venue_type);
1138
1139
1140 --
1141 -- Name: virtual_hosts_hostname_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1142 --
1143
1144 ALTER TABLE ONLY virtual_hosts
1145     ADD CONSTRAINT virtual_hosts_hostname_key UNIQUE (hostname);
1146
1147
1148 --
1149 -- Name: virtual_hosts_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
1150 --
1151
1152 ALTER TABLE ONLY virtual_hosts
1153     ADD CONSTRAINT virtual_hosts_pkey PRIMARY KEY (virtual_host_id);
1154
1155
1156 --
1157 -- Name: idx_connections_node_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1158 --
1159
1160 CREATE INDEX idx_connections_node_id ON connections USING btree (node_id);
1161
1162
1163 --
1164 -- Name: idx_connections_timestamp_in; Type: INDEX; Schema: public; Owner: -; Tablespace:
1165 --
1166
1167 CREATE INDEX idx_connections_timestamp_in ON connections USING btree (timestamp_in);
1168
1169
1170 --
1171 -- Name: idx_connections_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1172 --
1173
1174 CREATE INDEX idx_connections_user_id ON connections USING btree (user_id);
1175
1176
1177 --
1178 -- Name: idx_connections_user_mac; Type: INDEX; Schema: public; Owner: -; Tablespace:
1179 --
1180
1181 CREATE INDEX idx_connections_user_mac ON connections USING btree (user_mac);
1182
1183
1184 --
1185 -- Name: idx_content_group_element_content_group_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1186 --
1187
1188 CREATE INDEX idx_content_group_element_content_group_id ON content_group_element USING btree (content_group_id);
1189
1190
1191 --
1192 -- Name: idx_content_group_element_valid_from_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace:
1193 --
1194
1195 CREATE INDEX idx_content_group_element_valid_from_timestamp ON content_group_element USING btree (valid_from_timestamp);
1196
1197
1198 --
1199 -- Name: idx_content_group_element_valid_until_timestamp; Type: INDEX; Schema: public; Owner: -; Tablespace:
1200 --
1201
1202 CREATE INDEX idx_content_group_element_valid_until_timestamp ON content_group_element USING btree (valid_until_timestamp);
1203
1204
1205 --
1206 -- Name: idx_gw_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1207 --
1208
1209 CREATE UNIQUE INDEX idx_gw_id ON nodes USING btree (gw_id);
1210
1211
1212 --
1213 -- Name: idx_token; Type: INDEX; Schema: public; Owner: -; Tablespace:
1214 --
1215
1216 CREATE INDEX idx_token ON connections USING btree (token);
1217
1218
1219 --
1220 -- Name: idx_token_status_and_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1221 --
1222
1223 CREATE INDEX idx_token_status_and_user_id ON connections USING btree (token_status, user_id);
1224
1225
1226 --
1227 -- Name: idx_unique_username_and_account_origin; Type: INDEX; Schema: public; Owner: -; Tablespace:
1228 --
1229
1230 CREATE UNIQUE INDEX idx_unique_username_and_account_origin ON users USING btree (username, account_origin);
1231
1232
1233 --
1234 -- Name: profile_template_fields_semantic_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
1235 --
1236
1237 CREATE INDEX profile_template_fields_semantic_id ON profile_template_fields USING btree (semantic_id);
1238
1239
1240 --
1241 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1242 --
1243
1244 ALTER TABLE ONLY connections
1245     ADD CONSTRAINT "$1" FOREIGN KEY (token_status) REFERENCES token_status(token_status);
1246
1247
1248 --
1249 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1250 --
1251
1252 ALTER TABLE ONLY users
1253     ADD CONSTRAINT "$1" FOREIGN KEY (prefered_locale) REFERENCES locales(locales_id) ON UPDATE CASCADE ON DELETE SET NULL;
1254
1255
1256 --
1257 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1258 --
1259
1260 ALTER TABLE ONLY content
1261     ADD CONSTRAINT "$1" FOREIGN KEY (title) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE RESTRICT;
1262
1263
1264 --
1265 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1266 --
1267
1268 ALTER TABLE ONLY content_has_owners
1269     ADD CONSTRAINT "$1" FOREIGN KEY (content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE;
1270
1271
1272 --
1273 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1274 --
1275
1276 ALTER TABLE ONLY content_langstring_entries
1277     ADD CONSTRAINT "$1" FOREIGN KEY (langstrings_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE;
1278
1279
1280 --
1281 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1282 --
1283
1284 ALTER TABLE ONLY content_group
1285     ADD CONSTRAINT "$1" FOREIGN KEY (content_group_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE;
1286
1287
1288 --
1289 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1290 --
1291
1292 ALTER TABLE ONLY content_group_element
1293     ADD CONSTRAINT "$1" FOREIGN KEY (content_group_element_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE;
1294
1295
1296 --
1297 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1298 --
1299
1300 ALTER TABLE ONLY content_group_element_has_allowed_nodes
1301     ADD CONSTRAINT "$1" FOREIGN KEY (content_group_element_id) REFERENCES content_group_element(content_group_element_id) ON UPDATE CASCADE ON DELETE CASCADE;
1302
1303
1304 --
1305 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1306 --
1307
1308 ALTER TABLE ONLY user_has_content
1309     ADD CONSTRAINT "$1" FOREIGN KEY (user_id) REFERENCES users(user_id) ON UPDATE CASCADE ON DELETE CASCADE;
1310
1311
1312 --
1313 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1314 --
1315
1316 ALTER TABLE ONLY node_has_content
1317     ADD CONSTRAINT "$1" FOREIGN KEY (node_id) REFERENCES nodes(node_id) ON UPDATE CASCADE ON DELETE CASCADE;
1318
1319
1320 --
1321 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1322 --
1323
1324 ALTER TABLE ONLY network_has_content
1325     ADD CONSTRAINT "$1" FOREIGN KEY (content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE;
1326
1327
1328 --
1329 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1330 --
1331
1332 ALTER TABLE ONLY content_display_log
1333     ADD CONSTRAINT "$1" FOREIGN KEY (user_id) REFERENCES users(user_id) ON UPDATE CASCADE ON DELETE CASCADE;
1334
1335
1336 --
1337 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1338 --
1339
1340 ALTER TABLE ONLY content_file_image
1341     ADD CONSTRAINT "$1" FOREIGN KEY (pictures_id) REFERENCES content_file(files_id) ON UPDATE CASCADE ON DELETE CASCADE;
1342
1343
1344 --
1345 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1346 --
1347
1348 ALTER TABLE ONLY content_iframe
1349     ADD CONSTRAINT "$1" FOREIGN KEY (iframes_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE;
1350
1351
1352 --
1353 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1354 --
1355
1356 ALTER TABLE ONLY content_rss_aggregator
1357     ADD CONSTRAINT "$1" FOREIGN KEY (content_id) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE CASCADE;
1358
1359
1360 --
1361 -- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: -
1362 --
1363
1364 ALTER TABLE ONLY content_rss_aggregator_feeds
1365     ADD CONSTRAINT "$1" FOREIGN KEY (content_id) REFERENCES content_rss_aggregator(content_id) ON UPDATE CASCADE ON DELETE CASCADE;
1366
1367
1368 --
1369 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: -
1370 --
1371
1372 ALTER TABLE ONLY content
1373     ADD CONSTRAINT "$2" FOREIGN KEY (description) REFERENCES content(content_id) ON UPDATE CASCADE ON DELETE RESTRICT;
1374
1375
1376 --
1377 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: -
1378 --
1379
1380 ALTER TABLE ONLY content_has_owners
1381     ADD CONSTRAINT "$2" FOREIGN KEY (user_id) REFERENCES users(user_id) ON UPDATE CASCADE ON DELETE CASCADE;
1382
1383
1384 --
1385 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: -
1386 --
1387
1388 ALTER TABLE ONLY content_langstring_entries
1389     ADD CONSTRAINT "$2" FOREIGN KEY (locales_id) REFERENCES locales(locales_id) ON UPDATE CASCADE ON DELETE RESTRICT;
1390
1391
1392 --
1393 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: -
1394 --
1395
1396 ALTER TABLE ONLY content_group_element
1397     ADD CONSTRAINT "$2" FOREIGN KEY (content_group_id) REFERENCES content_group(content_group_id) ON UPDATE CASCADE ON DELETE CASCADE;
1398
1399
1400 --
1401 -- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: -
1402 --
1403
1404 ALTER TABLE ONLY c