1SET client_encoding = 'UTF8';
2SET check_function_bodies = false;
3SET client_min_messages = warning;
4SET search_path = public, pg_catalog;
5SET default_tablespace = '';
6SET default_with_oids = false;
7
8
9--
10-- Table structure for table answers
11--
12CREATE TABLE prefix_answers (
13    "qid" integer DEFAULT 0 NOT NULL,
14    "code" character varying(5) DEFAULT '' NOT NULL,
15    "answer" text NOT NULL,
16    "sortorder" integer NOT NULL,
17    "language" character varying(20) DEFAULT 'en',
18    "assessment_value" integer DEFAULT 0 NOT NULL,
19    "scale_id" integer DEFAULT 0 NOT NULL,
20    CONSTRAINT prefix_answers_pkey PRIMARY KEY (qid, code, "language", scale_id)
21);
22
23
24--
25-- Table structure for table assessments
26--
27CREATE TABLE prefix_assessments (
28    "id" serial NOT NULL,
29    "sid" integer DEFAULT 0 NOT NULL,
30    "scope" character varying(5) DEFAULT '' NOT NULL,
31    "gid" integer DEFAULT 0 NOT NULL,
32    "name" text NOT NULL,
33    "minimum" character varying(50) DEFAULT '' NOT NULL,
34    "maximum" character varying(50) DEFAULT '' NOT NULL,
35    "message" text NOT NULL,
36    "language" character varying(20) DEFAULT 'en' NOT NULL,
37    CONSTRAINT prefix_assessments_pkey PRIMARY KEY (id,language)
38);
39
40
41--
42-- Table structure for table conditions
43--
44CREATE TABLE prefix_conditions (
45    "cid" serial NOT NULL,
46    "qid" integer DEFAULT 0 NOT NULL,
47    "cqid" integer DEFAULT 0 NOT NULL,
48    "cfieldname" character varying(50) DEFAULT '' NOT NULL,
49    "method" character varying(5) DEFAULT '' NOT NULL,
50    "value" character varying(255) DEFAULT '' NOT NULL,
51    "scenario" integer DEFAULT 1 NOT NULL,
52    CONSTRAINT prefix_conditions_pkey PRIMARY KEY (cid)
53);
54
55
56--
57-- Table structure for table defaultvalues
58--
59CREATE TABLE prefix_defaultvalues (
60    "qid" integer NOT NULL default '0',
61    "scale_id" integer NOT NULL default '0',
62    "sqid" integer NOT NULL default '0',
63    "language" character varying(20) NOT NULL,
64    "specialtype" character varying(20) NOT NULL default '',
65    "defaultvalue" text,
66    CONSTRAINT prefix_defaultvalues_pkey PRIMARY KEY (qid , specialtype, language, scale_id, sqid)
67);
68
69
70--
71-- Table structure for table expression_errors
72--
73
74CREATE TABLE prefix_expression_errors (
75  "id" serial NOT NULL,
76  "errortime" character varying(50),
77  "sid" integer,
78  "gid" integer,
79  "qid" integer,
80  "gseq" integer,
81  "qseq" integer,
82  "type" character varying(50) ,
83  "eqn" text,
84  "prettyprint" text,
85  CONSTRAINT prefix_expression_errors_pkey PRIMARY KEY (id)
86);
87
88
89--
90-- Create failed_login_attempts
91--
92CREATE TABLE prefix_failed_login_attempts (
93  "id" serial PRIMARY KEY NOT NULL,
94  "ip" character varying(40) NOT NULL,
95  "last_attempt" character varying(20) NOT NULL,
96  "number_attempts" integer NOT NULL
97);
98
99
100--
101-- Table structure for table groups
102--
103CREATE TABLE prefix_groups (
104    "gid" serial NOT NULL,
105    "sid" integer DEFAULT 0 NOT NULL,
106    "group_name" character varying(100) DEFAULT '' NOT NULL,
107    "group_order" integer DEFAULT 0 NOT NULL,
108    "description" text,
109    "language" character varying(20) DEFAULT 'en',
110    "randomization_group" character varying(20) DEFAULT '' NOT NULL,
111    "grelevance" text DEFAULT NULL,
112    CONSTRAINT prefix_groups_pkey PRIMARY KEY (gid, "language")
113);
114
115
116--
117-- Table structure for table labels
118--
119CREATE TABLE prefix_labels (
120    "lid" integer DEFAULT 0 NOT NULL,
121    "code" character varying(5) DEFAULT '' NOT NULL,
122    "title" text,
123    "sortorder" integer NOT NULL,
124    "assessment_value" integer DEFAULT 0 NOT NULL,
125    "language" character varying(20) DEFAULT 'en' NOT NULL,
126    CONSTRAINT prefix_labels_pkey PRIMARY KEY (lid, sortorder, "language")
127);
128
129
130--
131-- Table structure for table labelsets
132--
133CREATE TABLE prefix_labelsets (
134    "lid" serial NOT NULL,
135    "label_name" character varying(100) DEFAULT '' NOT NULL,
136    "languages" character varying(200) DEFAULT 'en',
137    CONSTRAINT prefix_labelsets_pkey PRIMARY KEY (lid)
138);
139
140
141--
142-- Table structure for table participant_attribute
143--
144CREATE TABLE prefix_participant_attribute (
145  "participant_id" character varying( 50 ) NOT NULL,
146  "attribute_id" integer NOT NULL,
147  "value" text NOT NULL,
148  CONSTRAINT prefix_participant_attribut_pkey PRIMARY KEY (participant_id,attribute_id)
149);
150
151
152--
153-- Table structure for table participant_attribute_lang
154--
155CREATE TABLE prefix_participant_attribute_names_lang (
156  "attribute_id" integer NOT NULL,
157  "attribute_name" character varying( 255 ) NOT NULL,
158  "lang" character varying( 20 ) NOT NULL,
159  CONSTRAINT prefix_participant_attribute_names_lang_pkey PRIMARY KEY (attribute_id,lang)
160);
161
162
163--
164-- Table structure for table participant_attribute_names
165--
166CREATE TABLE prefix_participant_attribute_names (
167  "attribute_id" serial NOT NULL,
168  "attribute_type" character varying( 4 ) NOT NULL,
169  "defaultname" character varying(255) NOT NULL,
170  "visible" character varying( 5 ) NOT NULL,
171  CONSTRAINT prefix_participant_attribute_names_pkey PRIMARY KEY (attribute_id, attribute_type)
172);
173
174
175--
176-- Table structure for table participant_attribute_values
177--
178CREATE TABLE prefix_participant_attribute_values (
179  "value_id" serial PRIMARY KEY NOT NULL,
180  "attribute_id" integer NOT NULL,
181  "value" text NOT NULL
182);
183
184
185--
186-- Table structure for table participant_shares
187--
188CREATE TABLE prefix_participant_shares (
189  "participant_id" character varying( 50 ) NOT NULL,
190  "share_uid" integer NOT NULL,
191  "date_added" timestamp NOT NULL,
192  "can_edit" character varying( 5 ) NOT NULL,
193  CONSTRAINT prefix_participant_shares_pkey PRIMARY KEY (participant_id,share_uid)
194);
195
196
197--
198-- Table structure for table participants
199--
200CREATE TABLE prefix_participants (
201  "participant_id" character varying(50) PRIMARY KEY NOT NULL,
202  "firstname" character varying(150),
203  "lastname" character varying(150),
204  "email" text,
205  "language" character varying(40),
206  "blacklisted" character varying(1) NOT NULL,
207  "owner_uid" integer NOT NULL,
208  "created_by" integer NOT NULL,
209  "created" timestamp,
210  "modified" timestamp
211);
212
213
214--
215-- Table structure for table permissions
216--
217CREATE TABLE prefix_permissions (
218    "id" serial NOT NULL,
219    "entity" character varying(50) NOT NULL,
220    "entity_id" integer NOT NULL,
221    "uid" integer NOT NULL,
222    "permission" character varying(100) NOT NULL,
223    "create_p" integer DEFAULT 0 NOT NULL,
224    "read_p" integer DEFAULT 0 NOT NULL,
225    "update_p" integer DEFAULT 0 NOT NULL,
226    "delete_p" integer DEFAULT 0 NOT NULL,
227    "import_p" integer DEFAULT 0 NOT NULL,
228    "export_p" integer DEFAULT 0 NOT NULL,
229    CONSTRAINT prefix_permissions_pkey PRIMARY KEY (id)
230);
231
232
233--
234-- Table structure for table plugins
235--
236CREATE TABLE prefix_plugins (
237  "id" serial NOT NULL,
238  "name" character varying(50) NOT NULL,
239  "active" integer NOT NULL default '0',
240  "version" character varying(32) default NULL,
241  CONSTRAINT prefix_plugins_pkey PRIMARY KEY (id)
242);
243
244
245--
246-- Table structure for table plugin_settings
247--
248CREATE TABLE prefix_plugin_settings (
249  "id" serial NOT NULL,
250  "plugin_id" integer NOT NULL,
251  "model" character varying(50) NULL,
252  "model_id" integer NULL,
253  "key" character varying(50) NOT NULL,
254  "value" text NULL,
255  CONSTRAINT prefix_plugin_settings_pkey PRIMARY KEY (id)
256);
257
258
259--
260-- Table structure for table question_attributes
261--
262CREATE TABLE prefix_question_attributes (
263    "qaid" serial NOT NULL,
264    "qid" integer DEFAULT 0 NOT NULL,
265    "attribute" character varying(50),
266    "value" text NULL,
267    "language" character varying(20),
268    CONSTRAINT prefix_question_attributes_pkey PRIMARY KEY (qaid)
269);
270
271
272--
273-- Table structure for table questions
274--
275CREATE TABLE prefix_questions (
276    "qid" serial NOT NULL,
277    "parent_qid" integer DEFAULT 0 NOT NULL,
278    "sid" integer DEFAULT 0 NOT NULL,
279    "gid" integer DEFAULT 0 NOT NULL,
280    "type" character varying(1) DEFAULT 'T' NOT NULL,
281    "title" character varying(20) DEFAULT '' NOT NULL,
282    "question" text NOT NULL,
283    "preg" text,
284    "help" text,
285    "other" character varying(1) DEFAULT 'N' NOT NULL,
286    "mandatory" character varying(1),
287    "question_order" integer NOT NULL,
288    "language" character varying(20) DEFAULT 'en' NOT NULL,
289    "scale_id" integer DEFAULT 0 NOT NULL,
290    "same_default" integer DEFAULT 0 NOT NULL,
291    "relevance" text,
292    "modulename" character varying(255),
293    CONSTRAINT prefix_questions_pkey PRIMARY KEY (qid, "language")
294);
295
296
297--
298-- Table structure for table quota
299--
300CREATE TABLE prefix_quota (
301    "id" serial NOT NULL,
302    "sid" integer,
303    "name" character varying(255),
304    "qlimit" integer,
305    "action" integer,
306    "active" integer NOT NULL default '1',
307    "autoload_url" integer NOT NULL DEFAULT 0,
308    CONSTRAINT prefix_quota_pkey PRIMARY KEY (id)
309);
310
311
312--
313-- Table structure for table quota_languagesettings
314--
315CREATE TABLE prefix_quota_languagesettings
316(
317    "quotals_id" serial NOT NULL,
318    "quotals_quota_id" integer NOT NULL DEFAULT 0,
319    "quotals_language" character varying(45) NOT NULL DEFAULT 'en',
320    "quotals_name" character varying(255),
321    "quotals_message" text NOT NULL,
322    "quotals_url" character varying(255),
323    "quotals_urldescrip" character varying(255),
324    CONSTRAINT prefix_quota_languagesettings_pkey PRIMARY KEY (quotals_id)
325);
326
327
328--
329-- Table structure for table quota_members
330--
331CREATE TABLE prefix_quota_members (
332    "id" serial NOT NULL,
333    "sid" integer,
334    "qid" integer,
335    "quota_id" integer,
336    "code" character varying(11),
337    CONSTRAINT prefix_quota_members_pkey PRIMARY KEY (id)
338);
339CREATE INDEX prefix_quota_members_ixcode_idx ON prefix_quota_members USING btree (sid, qid, quota_id, code);
340
341
342--
343-- Table structure for table saved_control
344--
345CREATE TABLE prefix_saved_control (
346    "scid" serial NOT NULL,
347    "sid" integer DEFAULT 0 NOT NULL,
348    "srid" integer DEFAULT 0 NOT NULL,
349    "identifier" text NOT NULL,
350    "access_code" text NOT NULL,
351    "email" character varying(254),
352    "ip" text NOT NULL,
353    "saved_thisstep" text NOT NULL,
354    "status" character varying(1) DEFAULT '' NOT NULL,
355    "saved_date" timestamp NOT NULL,
356    "refurl" text,
357    CONSTRAINT prefix_saved_control_pkey PRIMARY KEY (scid)
358);
359
360
361--
362-- Table structure for table sessions
363--
364CREATE TABLE prefix_sessions(
365      "id" character varying(32) NOT NULL,
366      "expire" integer DEFAULT NULL,
367      "data" bytea,
368      CONSTRAINT prefix_sessions_pkey PRIMARY KEY ( id )
369);
370
371
372--
373-- Table structure for table settings_global
374--
375CREATE TABLE prefix_settings_global (
376    "stg_name" character varying(50) DEFAULT '' NOT NULL,
377    "stg_value" text NOT NULL,
378    CONSTRAINT prefix_settings_global_pkey PRIMARY KEY (stg_name)
379);
380
381
382--
383-- Table structure for table survey_links
384--
385CREATE TABLE prefix_survey_links (
386  "participant_id" character varying ( 50 ) NOT NULL,
387  "token_id" integer NOT NULL,
388  "survey_id" integer NOT NULL,
389  "date_created" timestamp,
390  "date_invited" timestamp,
391  "date_completed" timestamp,
392  CONSTRAINT prefix_survey_links_pkey PRIMARY KEY (participant_id,token_id,survey_id)
393);
394
395
396--
397-- Table structure for table survey_url_parameters
398--
399CREATE TABLE prefix_survey_url_parameters (
400    "id" serial PRIMARY KEY NOT NULL,
401    "sid" integer NOT NULL,
402    "parameter" character varying(50) NOT NULL,
403    "targetqid" integer NULL,
404    "targetsqid" integer NULL
405);
406
407
408--
409-- Table structure for table surveys
410--
411CREATE TABLE prefix_surveys (
412    "sid" integer NOT NULL,
413    "gsid" integer NOT NULL,
414    "owner_id" integer NOT NULL,
415    "admin" character varying(50),
416    "active" character varying(1) DEFAULT 'N' NOT NULL,
417    "expires" timestamp,
418    "startdate" timestamp,
419    "adminemail" character varying(254),
420    "anonymized" character varying(1) DEFAULT 'N' NOT NULL,
421    "faxto" character varying(20),
422    "format" character varying(1),
423    "savetimings" character varying(1) DEFAULT 'N' NOT NULL,
424    "template" character varying(100) DEFAULT 'default',
425    "language" character varying(50),
426    "additional_languages" character varying(255),
427    "datestamp" character varying(1) DEFAULT 'N' NOT NULL,
428    "usecookie" character varying(1) DEFAULT 'N' NOT NULL,
429    "allowregister" character varying(1) DEFAULT 'N' NOT NULL,
430    "allowsave" character varying(1) DEFAULT 'Y' NOT NULL,
431    "autonumber_start" integer DEFAULT 0 NOT NULL,
432    "autoredirect" character varying(1) DEFAULT 'N' NOT NULL,
433    "allowprev" character varying(1) DEFAULT 'N' NOT NULL,
434    "printanswers" character varying(1) DEFAULT 'N' NOT NULL,
435    "ipaddr" character varying(1) DEFAULT 'N' NOT NULL,
436    "refurl" character varying(1) DEFAULT 'N' NOT NULL,
437    "datecreated" date,
438    "publicstatistics" character varying(1) DEFAULT 'N' NOT NULL,
439    "publicgraphs" character varying(1) DEFAULT 'N' NOT NULL,
440    "listpublic" character varying(1) DEFAULT 'N' NOT NULL,
441    "htmlemail" character varying(1) DEFAULT 'N' NOT NULL,
442    "sendconfirmation" character varying(1) DEFAULT 'Y' NOT NULL,
443    "tokenanswerspersistence" character varying(1) DEFAULT 'N' NOT NULL,
444    "assessments" character varying(1) DEFAULT 'N' NOT NULL,
445    "usecaptcha" character varying(1) DEFAULT 'N' NOT NULL,
446    "usetokens" character varying(1) DEFAULT 'N' NOT NULL,
447    "bounce_email" character varying(254),
448    "attributedescriptions" text,
449    "emailresponseto" text,
450    "emailnotificationto" text,
451    "tokenlength" integer DEFAULT '15' NOT NULL,
452    "showxquestions" character varying(1) DEFAULT 'Y',
453    "showgroupinfo" character varying(1) DEFAULT 'B',
454    "shownoanswer" character varying(1) DEFAULT 'Y',
455    "showqnumcode" character varying(1) DEFAULT 'X',
456    "bouncetime" integer,
457    "bounceprocessing" character varying(1) default 'N',
458    "bounceaccounttype" character varying(4),
459    "bounceaccounthost" character varying(200),
460    "bounceaccountpass" character varying(100),
461    "bounceaccountencryption" character varying(3),
462    "bounceaccountuser" character varying(200),
463    "showwelcome" character varying(1) DEFAULT 'Y',
464    "showprogress" character varying(1) DEFAULT 'Y',
465    "questionindex" integer DEFAULT '0' NOT NULL,
466    "navigationdelay" integer DEFAULT '0' NOT NULL,
467    "nokeyboard" character varying(1) DEFAULT 'N',
468    "alloweditaftercompletion" character varying(1) DEFAULT 'N',
469    "googleanalyticsstyle" character varying(1),
470    "googleanalyticsapikey" character varying(25),
471    CONSTRAINT prefix_surveys_pkey PRIMARY KEY (sid)
472);
473
474
475--
476-- Table structure for table surveys_languagesettings
477--
478CREATE TABLE prefix_surveys_languagesettings (
479    "surveyls_survey_id" integer NOT NULL,
480    "surveyls_language" character varying(45) DEFAULT 'en',
481    "surveyls_title" character varying(200) NOT NULL,
482    "surveyls_description" text,
483    "surveyls_welcometext" text,
484    "surveyls_endtext" text,
485    "surveyls_url" text,
486    "surveyls_urldescription" character varying(255),
487    "surveyls_email_invite_subj" character varying(255),
488    "surveyls_email_invite" text,
489    "surveyls_email_remind_subj" character varying(255),
490    "surveyls_email_remind" text,
491    "surveyls_email_register_subj" character varying(255),
492    "surveyls_email_register" text,
493    "surveyls_email_confirm_subj" character varying(255),
494    "surveyls_email_confirm" text,
495    "surveyls_dateformat" integer DEFAULT 1 NOT NULL,
496    "surveyls_attributecaptions" text,
497    "email_admin_notification_subj" character varying(255),
498    "email_admin_notification" text,
499    "email_admin_responses_subj" character varying(255),
500    "email_admin_responses" text,
501    "surveyls_numberformat" integer NOT NULL DEFAULT 0,
502    "attachments" text DEFAULT NULL,
503    CONSTRAINT prefix_surveys_languagesettings_pkey PRIMARY KEY (surveyls_survey_id, surveyls_language)
504);
505
506
507--
508-- Table structure for table user_groups
509--
510CREATE TABLE prefix_user_groups (
511    "ugid" serial PRIMARY KEY NOT NULL,
512    "name" character varying(20) NOT NULL,
513    "description" text NOT NULL,
514    "owner_id" integer NOT NULL
515);
516
517
518--
519-- Table structure for table user_in_groups
520--
521CREATE TABLE prefix_user_in_groups (
522    "ugid" integer NOT NULL,
523    "uid" integer NOT NULL,
524    CONSTRAINT prefix_user_in_groups_pkey PRIMARY KEY (ugid, uid)
525);
526
527
528--
529-- Table structure for table users
530--
531CREATE TABLE prefix_users (
532    "uid" serial PRIMARY KEY NOT NULL,
533    "users_name" character varying(64) DEFAULT '' UNIQUE NOT NULL,
534    "password" bytea NOT NULL,
535    "full_name" character varying(50) NOT NULL,
536    "parent_id" integer NOT NULL,
537    "lang" character varying(20),
538    "email" character varying(254),
539    "htmleditormode" character varying(7) DEFAULT 'default',
540    "templateeditormode" character varying(7) DEFAULT 'default' NOT NULL,
541    "questionselectormode" character varying(7) DEFAULT 'default' NOT NULL,
542    "one_time_pw" bytea,
543    "dateformat" integer DEFAULT 1 NOT NULL,
544    "created" timestamp,
545    "modified" timestamp
546);
547
548
549--CREATE SEQUENCE prefix_boxes;
550
551CREATE TABLE prefix_boxes (
552  "id" serial PRIMARY KEY NOT NULL,
553  "position" integer DEFAULT NULL ,
554  "url" text NOT NULL ,
555  "title" text NOT NULL ,
556  "ico" text DEFAULT NULL,
557  "desc" text NOT NULL ,
558  "page" text NOT NULL ,
559  "usergroup" integer NOT NULL
560);
561
562INSERT INTO "prefix_boxes" ("id", "position", "url", "title", "ico", "desc", "page", "usergroup") VALUES
563(1, 1, 'admin/survey/sa/newsurvey', 'Create survey', 'add', 'Create a new survey', 'welcome', '-2'),
564(2, 2, 'admin/survey/sa/listsurveys', 'List surveys', 'list', 'List available surveys', 'welcome', '-1'),
565(3, 3, 'admin/globalsettings', 'Global settings', 'settings', 'Edit global settings', 'welcome', '-2'),
566(4, 4, 'admin/update', 'ComfortUpdate', 'shield', 'Stay safe and up to date', 'welcome', '-2'),
567(5, 5, 'admin/labels/sa/view', 'Label sets', 'label', 'Edit label sets', 'welcome', '-2'),
568(6, 6, 'admin/templateoptions', 'Templates', 'templates', 'View templates list', 'welcome', '-2');
569
570--
571-- Secondary indexes
572--
573create index answers_idx2 on prefix_answers (sortorder);
574create index assessments_idx2 on prefix_assessments (sid);
575create index assessments_idx3 on prefix_assessments (gid);
576create index conditions_idx2 on prefix_conditions (qid);
577create index conditions_idx3 on prefix_conditions (cqid);
578create index groups_idx2 on prefix_groups (sid);
579create index question_attributes_idx2 on prefix_question_attributes (qid);
580create index question_attributes_idx3 on prefix_question_attributes (attribute);
581create index questions_idx2 on prefix_questions (sid);
582create index questions_idx3 on prefix_questions (gid);
583create index questions_idx4 on prefix_questions (type);
584create index quota_idx2 on prefix_quota (sid);
585create index saved_control_idx2 on prefix_saved_control (sid);
586create index parent_qid_idx on prefix_questions (parent_qid);
587create index labels_code_idx on prefix_labels (code);
588create unique index permissions_idx2 ON prefix_permissions (entity_id, entity, uid, permission);
589
590--
591-- Table notifications
592--
593CREATE TABLE prefix_notifications (
594    "id" serial PRIMARY KEY NOT NULL,
595    "entity" character varying(15) NOT NULL,
596    "entity_id" integer NOT NULL,
597    "title" character varying(255) NOT NULL,
598    "message" TEXT NOT NULL,
599    "status" character varying(15) NOT NULL DEFAULT 'new',
600    "importance" integer NOT NULL DEFAULT 1,
601    "display_class" character varying(31) DEFAULT 'default',
602    "hash" character varying(64) DEFAULT NULL,
603    "created" timestamp NOT NULL,
604    "first_read" timestamp DEFAULT NULL
605);
606CREATE INDEX prefix_index ON prefix_notifications USING btree (entity, entity_id, status);
607CREATE INDEX notif_hash_index ON prefix_notifications USING btree (hash);
608
609--
610-- Table settings_user
611--
612CREATE TABLE prefix_settings_user (
613    "id" serial PRIMARY KEY NOT NULL,
614    "uid" integer NOT NULL,
615    "entity" character varying(15) DEFAULT NULL,
616    "entity_id" character varying(31) DEFAULT NULL,
617    "stg_name" character varying(63) NOT NULL,
618    "stg_value" text NULL
619);
620
621
622--
623-- Surveymenu
624--
625CREATE TABLE prefix_surveymenu (
626  "id" serial PRIMARY KEY NOT NULL,
627  "parent_id" integer DEFAULT NULL,
628  "survey_id" integer DEFAULT NULL,
629  "user_id" integer DEFAULT NULL,
630  "ordering" integer DEFAULT '0',
631  "level" integer DEFAULT '0',
632  "title" character varying(255)  NOT NULL DEFAULT '',
633  "position" character varying(255) NOT NULL DEFAULT 'side',
634  "description" text ,
635  "active" integer NOT NULL DEFAULT '0',
636  "changed_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
637  "changed_by" integer NOT NULL DEFAULT '0',
638  "created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
639  "created_by" integer NOT NULL DEFAULT '0'
640);
641
642create index surveymenu_ordering_index on prefix_surveymenu ("ordering");
643create index surveymenu_title_index on prefix_surveymenu ("title");
644
645
646INSERT INTO prefix_surveymenu VALUES (1,NULL,NULL,NULL,0,0,'surveymenu','side','Main survey menu',1, NOW(),0,NOW(),0);
647INSERT INTO prefix_surveymenu VALUES (2,NULL,NULL,NULL,0,0,'quickmenue','collapsed','quickmenu',1, NOW(),0,NOW(),0);
648
649--
650-- Surveymenu entries
651--
652CREATE TABLE prefix_surveymenu_entries (
653  "id" serial PRIMARY KEY NOT NULL,
654  "menu_id" integer DEFAULT NULL,
655  "user_id" integer DEFAULT NULL,
656  "ordering" integer DEFAULT '0',
657  "name" character varying(255)  NOT NULL DEFAULT '',
658  "title" character varying(255)  NOT NULL DEFAULT '',
659  "menu_title" character varying(255)  NOT NULL DEFAULT '',
660  "menu_description" text ,
661  "menu_icon" character varying(255)  NOT NULL DEFAULT '',
662  "menu_icon_type" character varying(255)  NOT NULL DEFAULT '',
663  "menu_class" character varying(255)  NOT NULL DEFAULT '',
664  "menu_link" character varying(255)  NOT NULL DEFAULT '',
665  "action" character varying(255)  NOT NULL DEFAULT '',
666  "template" character varying(255)  NOT NULL DEFAULT '',
667  "partial" character varying(255)  NOT NULL DEFAULT '',
668  "classes" character varying(255)  NOT NULL DEFAULT '',
669  "permission" character varying(255)  NOT NULL DEFAULT '',
670  "permission_grade" character varying(255)  DEFAULT NULL,
671  "data" text ,
672  "getdatamethod" character varying(255)  NOT NULL DEFAULT '',
673  "language" character varying(255)  NOT NULL DEFAULT 'en-GB',
674  "changed_at" timestamp NULL,
675  "changed_by" integer NOT NULL DEFAULT '0',
676  "created_at" timestamp NOT NULL,
677  "created_by" integer NOT NULL DEFAULT '0'
678);
679
680create index surveymenu_entries_menu_id_index on prefix_surveymenu_entries ("menu_id");
681create index surveymenu_entries_ordering_index on prefix_surveymenu_entries ("ordering");
682create index surveymenu_entries_title_index on prefix_surveymenu_entries (title);
683create index surveymenu_entries_menu_title_index on prefix_surveymenu_entries (menu_title);
684
685INSERT INTO prefix_surveymenu_entries VALUES
686(1,1,NULL,1,'overview','Survey overview','Overview','Open general survey overview and quick action','list','fontawesome','','admin/survey/sa/view','','','','','','','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
687(2,1,NULL,2,'generalsettings','Edit survey general settings','General settings','Open general survey settings','gears','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_generaloptions_panel','','surveysettings','read',NULL,'_generalTabEditSurvey','en-GB',NOW(),0,NOW(),0),
688(3,1,NULL,3,'surveytexts','Edit survey text elements','Survey texts','Edit survey text elements','file-text-o','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/tab_edit_view','','surveylocale','read',NULL,'_getTextEditData','en-GB',NOW(),0,NOW(),0),
689(4,1,NULL,4,'template_options','Template options','Template options','Edit Template options for this survey','paint-brush','fontawesome','','admin/templateoptions/sa/updatesurvey','','','','','templates','read','{"render": {"link": { "pjaxed": false, "data": {"surveyid": ["survey","sid"], "gsid":["survey","gsid"]}}}}','','en-GB',NOW(),0,NOW(),0),
690(5,1,NULL,5,'participants','Survey participants','Survey participants','Go to survey participant and token settings','user','fontawesome','','admin/tokens/sa/index/','','','','','surveysettings','update','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
691(6,1,NULL,6,'presentation','Presentation & navigation settings','Presentation','Edit presentation and navigation settings','eye-slash','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_presentation_panel','','surveylocale','read',NULL,'_tabPresentationNavigation','en-GB',NOW(),0,NOW(),0),
692(7,1,NULL,7,'publication','Publication and access control settings','Publication & access','Edit settings for publicationa and access control','key','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_publication_panel','','surveylocale','read',NULL,'_tabPublicationAccess','en-GB',NOW(),0,NOW(),0),
693(8,1,NULL,8,'surveypermissions','Edit surveypermissions','Survey permissions','Edit permissions for this survey','lock','fontawesome','','admin/surveypermission/sa/view/','','','','','surveysecurity','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
694(9,1,NULL,9,'tokens','Token handling','Participant tokens','Define how tokens should be treated or generated','users','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_tokens_panel','','surveylocale','read',NULL,'_tabTokens','en-GB',NOW(),0,NOW(),0),
695(10,1,NULL,10,'quotas','Edit quotas','Survey quotas','Edit quotas for this survey.','tasks','fontawesome','','admin/quotas/sa/index/','','','','','quotas','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
696(11,1,NULL,11,'assessments','Edit assessments','Assessments','Edit and look at the asessements for this survey.','comment-o','fontawesome','','admin/assessments/sa/index/','','','','','assessments','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
697(12,1,NULL,12,'notification','Notification and data management settings','Data management','Edit settings for notification and data management','feed','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_notification_panel','','surveylocale','read',NULL,'_tabNotificationDataManagement','en-GB',NOW(),0,NOW(),0),
698(13,1,NULL,13,'emailtemplates','Email templates','Email templates','Edit the templates for invitation, reminder and registration emails','envelope-square','fontawesome','','admin/emailtemplates/sa/index/','','','','','assessments','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
699(14,1,NULL,14,'panelintegration','Edit survey panel integration','Panel integration','Define panel integrations for your survey','link','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_integration_panel','','surveylocale','read',NULL,'_tabPanelIntegration','en-GB',NOW(),0,NOW(),0),
700(15,1,NULL,15,'ressources','Add/Edit ressources to the survey','Ressources','Add/Edit ressources to the survey','file','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_resources_panel','','surveylocale','read',NULL,'_tabResourceManagement','en-GB',NOW(),0,NOW(),0),
701(16,2,NULL,1,'activateSurvey','Activate survey','Activate survey','Activate survey','play','fontawesome','','admin/survey/sa/activate','','','','','surveyactivation','update','{\"render\": {\"isActive\": false, \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
702(17,2,NULL,2,'deactivateSurvey','Stop this survey','Stop this survey','Stop this survey','stop','fontawesome','','admin/survey/sa/deactivate','','','','','surveyactivation','update','{\"render\": {\"isActive\": true, \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
703(18,2,NULL,3,'testSurvey','Go to survey','Go to survey','Go to survey','cog','fontawesome','','survey/index/','','','','','','','{\"render\"\: {\"link\"\: {\"external\"\: true, \"data\"\: {\"sid\"\: [\"survey\",\"sid\"], \"newtest\"\: \"Y\", \"lang\"\: [\"survey\",\"language\"]}}}}','','en-GB',NOW(),0,NOW(),0),
704(19,2,NULL,4,'listQuestions','List questions','List questions','List questions','list','fontawesome','','admin/survey/sa/listquestions','','','','','surveycontent','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
705(20,2,NULL,5,'listQuestionGroups','List question groups','List question groups','List question groups','th-list','fontawesome','','admin/survey/sa/listquestiongroups','','','','','surveycontent','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
706(21,2,NULL,6,'generalsettings','Edit survey general settings','General settings','Open general survey settings','gears','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_generaloptions_panel','','surveysettings','read',NULL,'_generalTabEditSurvey','en-GB',NOW(),0,NOW(),0),
707(22,2,NULL,7,'surveypermissions','Edit surveypermissions','Survey permissions','Edit permissions for this survey','lock','fontawesome','','admin/surveypermission/sa/view/','','','','','surveysecurity','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
708(23,2,NULL,8,'quotas','Edit quotas','Survey quotas','Edit quotas for this survey.','tasks','fontawesome','','admin/quotas/sa/index/','','','','','quotas','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
709(24,2,NULL,9,'assessments','Edit assessments','Assessments','Edit and look at the asessements for this survey.','comment-o','fontawesome','','admin/assessments/sa/index/','','','','','assessments','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
710(25,2,NULL,10,'emailtemplates','Email templates','Email templates','Edit the templates for invitation, reminder and registration emails','envelope-square','fontawesome','','admin/emailtemplates/sa/index/','','','','','surveylocale','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
711(26,2,NULL,11,'surveyLogicFile','Survey logic file','Survey logic file','Survey logic file','sitemap','fontawesome','','admin/expressions/sa/survey_logic_file/','','','','','surveycontent','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0),
712(27,2,NULL,12,'tokens','Token handling','Participant tokens','Define how tokens should be treated or generated','user','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_tokens_panel','','surveylocale','read','{\"render\": { \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','_tabTokens','en-GB',NOW(),0,NOW(),0),
713(28,2,NULL,13,'cpdb','Central participant database','Central participant database','Central participant database','users','fontawesome','','admin/participants/sa/displayParticipants','','','','','tokens','read','{render\: {\"link\"\: {}}','','en-GB',NOW(),0,NOW(),0),
714(29,2,NULL,14,'responses','Responses','Responses','Responses','icon-browse','iconclass','','admin/responses/sa/browse/','','','','','responses','read','{\"render\"\: {\"isActive\"\: true}}','','en-GB',NOW(),0,NOW(),0),
715(30,2,NULL,15,'statistics','Statistics','Statistics','Statistics','bar-chart','fontawesome','','admin/statistics/sa/index/','','','','','statistics','read','{\"render\"\: {\"isActive\"\: true}}','','en-GB',NOW(),0,NOW(),0),
716(31,2,NULL,16,'reorder','Reorder questions/question groups','Reorder questions/question groups','Reorder questions/question groups','icon-organize','iconclass','','admin/survey/sa/organize/','','','','','surveycontent','update','{\"render\": {\"isActive\": false, \"link\": {\"data\": {\"surveyid\": [\"survey\",\"sid\"]}}}}','','en-GB',NOW(),0,NOW(),0);
717
718
719-- -----------------------------------------------------
720-- Table prefix_templates
721-- -----------------------------------------------------
722CREATE TABLE prefix_templates (
723  "id" serial PRIMARY KEY NOT NULL,
724  "name" character varying(150)  NOT NULL,
725  "folder" character varying(45)  DEFAULT NULL,
726  "title" character varying(100)  NOT NULL,
727  "creation_date" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
728  "author" character varying(150)  DEFAULT NULL,
729  "author_email" character varying(255)  DEFAULT NULL,
730  "author_url" character varying(255)  DEFAULT NULL,
731  "copyright" text ,
732  "license" text ,
733  "version" character varying(45)  DEFAULT NULL,
734  "api_version" character varying(45)  NOT NULL,
735  "view_folder" character varying(45)  NOT NULL,
736  "files_folder" character varying(45)  NOT NULL,
737  "description" text ,
738  "last_update" timestamp DEFAULT NULL,
739  "owner_id" int DEFAULT NULL,
740  "extends" character varying(150)  DEFAULT NULL
741);
742
743
744
745INSERT INTO prefix_templates VALUES
746(1,'default', 'default', 'Advanced Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', 'LimeSurvey Advanced Template:\\r\\nMany options for user customizations. \\r\\n', NULL, 1, '');
747INSERT INTO prefix_templates VALUES
748(2,'minimal', 'minimal', 'Minimal Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', '<strong>LimeSurvey Minimal Template</strong><br>A clean and simple base that can be used by developers to create their own solution.', NULL, 1, '');
749INSERT INTO prefix_templates VALUES
750(3,'material', 'material', 'Material Template', '2017-07-12 10:00:00', 'Louis Gac', 'louis.gac@limesurvey.org', 'https://www.limesurvey.org/', 'Copyright (C) 2007-2017 The LimeSurvey Project Team\\r\\nAll rights reserved.', 'License: GNU/GPL License v2 or later, see LICENSE.php\\r\\n\\r\\nLimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details.', '1.0', '3.0', 'views', 'files', '<strong>LimeSurvey Advanced Template</strong><br> A template extending default, to show the inheritance concept. Notice the options, differents from Default.<br><small>uses FezVrasta''s Material design theme for Bootstrap 3</small>', NULL, 1, 'default');
751
752-- -----------------------------------------------------
753-- Table prefix_template_configuration
754-- -----------------------------------------------------
755CREATE TABLE prefix_template_configuration (
756  "id" serial PRIMARY KEY NOT NULL,
757  template_name character varying(150)  NOT NULL,
758  sid integer DEFAULT NULL,
759  gsid integer DEFAULT NULL,
760  uid integer DEFAULT NULL,
761  files_css text ,
762  files_js text ,
763  files_print_css text ,
764  options text ,
765  cssframework_name character varying(45)  DEFAULT NULL,
766  cssframework_css text ,
767  cssframework_js text ,
768  packages_to_load text ,
769  packages_ltr text ,
770  packages_rtl text
771);
772
773
774INSERT INTO prefix_template_configuration VALUES
775  (1,'default',NULL,NULL,NULL,'{"add": ["css/template.css", "css/animate.css"]}','{"add": ["scripts/template.js"]}','{"add":"css/print_template.css",}','{"ajaxmode":"off","brandlogo":"on", "boxcontainer":"on", "backgroundimage":"on","animatebody":"on","bodyanimation":"fadeInRight","animatequestion":"off","questionanimation":"flipInX","animatealert":"off","alertanimation":"shake"}','bootstrap','{"replace": [["css/bootstrap.css","css/flatly.css"]]}','','','','');
776
777INSERT INTO prefix_template_configuration VALUES
778  (2, 'minimal', NULL, NULL, NULL, '{"add": ["css/template.css"]}', '{"add": ["scripts/template.js"]}', '{"add":"css/print_template.css",}', '{}', 'bootstrap', '{}', '', '', '', '');
779
780INSERT INTO prefix_template_configuration VALUES
781  (3,'material',NULL,NULL,NULL,'{"add": ["css/template.css", "css/bootstrap-material-design.css", "css/ripples.min.css"]}','{"add": ["scripts/template.js", "scripts/material.js", "scripts/ripples.min.js"]}','{"add":"css/print_template.css",}','{"ajaxmode":"off","brandlogo":"on", "animatebody":"on","bodyanimation":"fadeInRight","animatequestion":"off","questionanimation":"flipInX","animatealert":"off","alertanimation":"shake"}','bootstrap','{"replace": [["css/bootstrap.css","css/bootstrap.css"]]}','','','','');
782
783-- -----------------------------------------------------
784-- Table prefix_surveys_groups
785-- -----------------------------------------------------
786CREATE TABLE "prefix_surveys_groups" (
787  "gsid" serial PRIMARY KEY NOT NULL,
788  "name" character varying(45) NOT NULL,
789  "title" character varying(100) DEFAULT NULL,
790  "template" character varying(128) DEFAULT 'default',
791  "description" text ,
792  "sortorder" integer NOT NULL,
793  "owner_uid" integer DEFAULT NULL,
794  "parent_id" integer DEFAULT NULL,
795  "created" timestamp DEFAULT NULL,
796  "modified" timestamp DEFAULT NULL,
797  "created_by" integer NOT NULL
798);
799
800
801INSERT INTO "prefix_surveys_groups" ("gsid", "name", "title", "description", "sortorder", "owner_uid", "parent_id", "created", "modified", "created_by") VALUES
802  (1, 'default', 'Default Survey Group', 'LimeSurvey core default survey group', 0, 1, NULL, '2017-07-20 17:09:30', '2017-07-20 17:09:30', 1);
803
804--
805-- Version Info
806--
807INSERT INTO prefix_settings_global VALUES ('DBVersion', '315');
808