Skip to content

Commit

Permalink
Dev DAtabase scheme fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Sep 29, 2017
1 parent 9e4cf69 commit 3b39ac6
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 80 deletions.
2 changes: 1 addition & 1 deletion application/views/admin/templateoptions/index.php
Expand Up @@ -56,7 +56,7 @@
array(
'header' => gT('extends'),
'name' => 'templates_extends',
'value'=>'$data->template->extends_templates_name',
'value'=>'$data->template->extends',
'htmlOptions' => array('class' => 'col-md-2'),
),

Expand Down
2 changes: 1 addition & 1 deletion installer/sql/create-mssql.sql
Expand Up @@ -739,7 +739,7 @@ CREATE TABLE prefix_templates (
[description] nvarchar(max) NULL,
[last_update] datetime NULL,
[owner_id] int NULL,
[extends_templates_name] nvarchar(150) NULL
[extends] nvarchar(150) NULL
);


Expand Down
8 changes: 4 additions & 4 deletions installer/sql/create-mysql.sql
Expand Up @@ -607,7 +607,7 @@ CREATE TABLE IF NOT EXISTS `prefix_notifications` (
--
-- Table settings_user
--
CREATE TABLE IF NOT EXISTS `prefix_settings_user` (
CREATE TABLE `prefix_settings_user` (
`id` int(11) NOT NULL auto_increment,
`uid` int(11) NOT NULL,
`entity` VARCHAR(15) DEFAULT NULL,
Expand Down Expand Up @@ -736,7 +736,7 @@ CREATE TABLE `prefix_templates` (
`description` text COLLATE utf8mb4_unicode_ci,
`last_update` datetime DEFAULT NULL,
`owner_id` int(11) DEFAULT NULL,
`extends_templates_name` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`extends` varchar(150) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

Expand All @@ -747,7 +747,7 @@ INSERT INTO `prefix_templates` VALUES
INSERT INTO `prefix_templates` VALUES
(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, '');
INSERT INTO `prefix_templates` VALUES
('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');
(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');


-- -----------------------------------------------------
Expand Down Expand Up @@ -785,7 +785,7 @@ INSERT INTO `prefix_template_configuration` VALUES
-- Table prefix_surveys_groups
-- -----------------------------------------------------
CREATE TABLE `prefix_surveys_groups` (
`gsid` int(11) NOT NULL,
`gsid` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL,
`title` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`template` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT 'default',
Expand Down
143 changes: 69 additions & 74 deletions installer/sql/create-pgsql.sql
Expand Up @@ -548,15 +548,14 @@ CREATE TABLE prefix_users (
--CREATE SEQUENCE prefix_boxes;

CREATE TABLE prefix_boxes (
"id" SERIAL,
"id" serial PRIMARY KEY NOT NULL,
"position" integer DEFAULT NULL ,
"url" text NOT NULL ,
"title" text NOT NULL ,
"ico" text DEFAULT NULL,
"desc" text NOT NULL ,
"page" text NOT NULL ,
"usergroup" integer NOT NULL,
PRIMARY KEY (id)
"usergroup" integer NOT NULL
);

INSERT INTO "prefix_boxes" ("id", "position", "url", "title", "ico", "desc", "page", "usergroup") VALUES
Expand Down Expand Up @@ -588,10 +587,10 @@ create index labels_code_idx on prefix_labels (code);
create unique index permissions_idx2 ON prefix_permissions (entity_id, entity, uid, permission);

--
-- Notification table
-- Table notifications
--
CREATE TABLE prefix_notifications (
"id" SERIAL,
"id" serial PRIMARY KEY NOT NULL,
"entity" character varying(15) NOT NULL,
"entity_id" integer NOT NULL,
"title" character varying(255) NOT NULL,
Expand All @@ -608,24 +607,23 @@ CREATE INDEX prefix_index ON prefix_notifications USING btree (entity, entity_id
CREATE INDEX notif_hash_index ON prefix_notifications USING btree (hash);

--
-- User settings table
-- Table settings_user
--
CREATE TABLE prefix_settings_user (
"id" serial PRIMARY KEY NOT NULL,
"uid" integer NOT NULL,
"entity" character varying(15) DEFAULT NULL,
"entity_id" character varying(31) DEFAULT NULL,
"stg_name" character varying(63) NOT NULL,
"stg_value" text NULL,
CONSTRAINT prefix_user_settings_pkey PRIMARY KEY (uid, entity, entity_id, stg_name)
"stg_value" text NULL
);


--
-- Surveymenu
--

CREATE TABLE prefix_surveymenu (
"id" integer NOT NULL,
"id" serial PRIMARY KEY NOT NULL,
"parent_id" integer DEFAULT NULL,
"survey_id" integer DEFAULT NULL,
"user_id" integer DEFAULT NULL,
Expand All @@ -634,24 +632,26 @@ CREATE TABLE prefix_surveymenu (
"title" character varying(255) NOT NULL DEFAULT '',
"position" character varying(255) NOT NULL DEFAULT 'side',
"description" text ,
"active" integer NOT NULL DEFAULT '0',
"changed_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"changed_by" integer NOT NULL DEFAULT '0',
"created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"created_by" integer NOT NULL DEFAULT '0',
PRIMARY KEY ("id")
);

create index menu_parent_id_index on prefix_surveymenu (parent_id);
create index menu_user_id_index on prefix_surveymenu (user_id);
create index menu_order_index on prefix_surveymenu ("ordering");
create index menu_title_index on prefix_surveymenu (title);
create index surveymenu_ordering_index on prefix_surveymenu ("ordering");
create index surveymenu_title_index on prefix_surveymenu ("title");


INSERT INTO prefix_surveymenu VALUES (1,NULL,NULL,NULL,0,0,'surveymenu','side','Main survey menu',NOW(),0,NOW(),0);
INSERT INTO prefix_surveymenu VALUES (2,NULL,NULL,NULL,0,0,'quickmenue','collapsed','quickmenu',NOW(),0,NOW(),0);

--
-- Surveymenu entries
--
CREATE TABLE prefix_surveymenu_entries (
"id" integer NOT NULL ,
"id" serial PRIMARY KEY NOT NULL,
"menu_id" integer DEFAULT NULL,
"user_id" integer DEFAULT NULL,
"ordering" integer DEFAULT '0',
Expand All @@ -672,18 +672,17 @@ CREATE TABLE prefix_surveymenu_entries (
"data" text ,
"getdatamethod" character varying(255) NOT NULL DEFAULT '',
"language" character varying(255) NOT NULL DEFAULT 'en-GB',
"changed_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"changed_at" timestamp NULL,
"changed_by" integer NOT NULL DEFAULT '0',
"created_at" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"created_at" timestamp NOT NULL,
"created_by" integer NOT NULL DEFAULT '0',
PRIMARY KEY (id),
FOREIGN KEY (menu_id) REFERENCES prefix_surveymenu (id) ON DELETE CASCADE
PRIMARY KEY (id)
);

create index entry_order_index on prefix_surveymenu_entries ("ordering");
create index entry_user_index on prefix_surveymenu_entries ("user_id");
create index entry_title_index on prefix_surveymenu_entries (title);
create index entry_menu_title_index on prefix_surveymenu_entries (menu_title);
create index surveymenu_entries_menu_id_index on prefix_surveymenu_entries (menu_id_index);
create index surveymenu_entries_ordering_index on prefix_surveymenu_entries ("ordering");
create index surveymenu_entries_title_index on prefix_surveymenu_entries (title);
create index surveymenu_entries_menu_title_index on prefix_surveymenu_entries (menu_title);

INSERT INTO prefix_surveymenu_entries VALUES
(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),
Expand Down Expand Up @@ -719,71 +718,48 @@ INSERT INTO prefix_surveymenu_entries VALUES
(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);


-- CREATE OR REPLACE FUNCTION upd_timestamp() RETURNS TRIGGER
-- LANGUAGE plpgsql
-- AS
-- $$
-- BEGIN
-- NEW.changed_at = CURRENT_TIMESTAMP;
-- RETURN NEW;
-- END;
-- $$;

-- CREATE TRIGGER update_timestamp_menues
-- BEFORE UPDATE
-- ON prefix_surveymenu
-- FOR EACH ROW
-- EXECUTE PROCEDURE upd_timestamp();
-- CREATE TRIGGER update_timestamp_menue_entries
-- BEFORE UPDATE
-- ON prefix_surveymenu_entries
-- FOR EACH ROW
-- EXECUTE PROCEDURE upd_timestamp();



-- -----------------------------------------------------
-- Table prefix_templates
-- -----------------------------------------------------
CREATE TABLE prefix_templates (
name character varying(150) NOT NULL,
folder character varying(45) DEFAULT NULL,
title character varying(100) NOT NULL,
creation_date timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
author character varying(150) DEFAULT NULL,
author_email character varying(255) DEFAULT NULL,
author_url character varying(255) DEFAULT NULL,
copyright text ,
license text ,
version character varying(45) DEFAULT NULL,
api_version character varying(45) NOT NULL,
view_folder character varying(45) NOT NULL,
files_folder character varying(45) NOT NULL,
description text ,
last_update timestamp DEFAULT NULL,
owner_id int DEFAULT NULL,
extends_templates_name character varying(150) DEFAULT NULL,
PRIMARY KEY (name)
"id" serial PRIMARY KEY NOT NULL,
"name" character varying(150) NOT NULL,
"folder" character varying(45) DEFAULT NULL,
"title" character varying(100) NOT NULL,
"creation_date" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"author" character varying(150) DEFAULT NULL,
"author_email" character varying(255) DEFAULT NULL,
"author_url" character varying(255) DEFAULT NULL,
"copyright" text ,
"license" text ,
"version" character varying(45) DEFAULT NULL,
"api_version" character varying(45) NOT NULL,
"view_folder" character varying(45) NOT NULL,
"files_folder" character varying(45) NOT NULL,
"description" text ,
"last_update" timestamp DEFAULT NULL,
"owner_id" int DEFAULT NULL,
"extends" character varying(150) DEFAULT NULL
);



INSERT INTO prefix_templates VALUES
('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, '');
(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, '');
INSERT INTO prefix_templates VALUES
('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, '');
(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, '');
INSERT INTO prefix_templates VALUES
('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');
(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');

-- -----------------------------------------------------
-- Table prefix_template_configuration
-- -----------------------------------------------------
CREATE TABLE prefix_template_configuration (
id int NOT NULL,
"id" serial PRIMARY KEY NOT NULL,
templates_name character varying(150) NOT NULL,
sid int DEFAULT NULL,
gsid int DEFAULT NULL,
uid int DEFAULT NULL,
sid integer DEFAULT NULL,
gsid integer DEFAULT NULL,
uid integer DEFAULT NULL,
files_css text ,
files_js text ,
files_print_css text ,
Expand All @@ -793,8 +769,7 @@ CREATE TABLE prefix_template_configuration (
cssframework_js text ,
packages_to_load text ,
packages_ltr text ,
packages_rtl text ,
PRIMARY KEY(id)
packages_rtl text
);


Expand All @@ -807,8 +782,28 @@ INSERT INTO prefix_template_configuration VALUES
INSERT INTO prefix_template_configuration VALUES
(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"]]}','','','','');

-- -----------------------------------------------------
-- Table prefix_surveys_groups
-- -----------------------------------------------------
CREATE TABLE "prefix_surveys_groups" (
"gsid" serial PRIMARY KEY NOT NULL,
"name" character varying(45) NOT NULL,
"title" character varying(100) DEFAULT NULL,
"template" character varying(128) DEFAULT 'default',
"description" text ,
"sortorder" integer NOT NULL,
"owner_uid" integer DEFAULT NULL,
"parent_id" integer DEFAULT NULL,
"created" timestamp DEFAULT NULL,
"modified" timestamp DEFAULT NULL,
"created_by" integer NOT NULL
);


INSERT INTO "prefix_surveys_groups" ("gsid", "name", "title", "description", "order", "owner_uid", "parent_id", "created", "modified", "created_by") VALUES
(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);

--
-- Version Info
--
INSERT INTO prefix_settings_global VALUES ('DBVersion', '309');
INSERT INTO prefix_settings_global VALUES ('DBVersion', '315');

0 comments on commit 3b39ac6

Please sign in to comment.