root/trunk/wifidog-auth/sql/wifidog-postgres-schema.sql

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