diff --git a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql index ddbf3c79f1f..eb062806dcf 100755 --- a/htdocs/install/mysql/migration/3.8.0-3.9.0.sql +++ b/htdocs/install/mysql/migration/3.8.0-3.9.0.sql @@ -250,4 +250,31 @@ CREATE TABLE llx_product_pricerules var_min_percent FLOAT NOT NULL -- Min price discount over general price ); ALTER TABLE llx_product ADD COLUMN price_autogen TINYINT(1) DEFAULT 0; -ALTER TABLE llx_product_pricerules ADD CONSTRAINT unique_level UNIQUE (level); \ No newline at end of file +ALTER TABLE llx_product_pricerules ADD CONSTRAINT unique_level UNIQUE (level); + + +-- Delete deprecated fields +ALTER TABLE llx_opensurvey_sondage DROP COLUMN survey_link_visible; +ALTER TABLE llx_opensurvey_sondage DROP INDEX idx_id_sondage_admin; +ALTER TABLE llx_opensurvey_sondage DROP COLUMN id_sondage_admin; +ALTER TABLE llx_opensurvey_sondage DROP COLUMN canedit; +ALTER TABLE llx_opensurvey_sondage DROP COLUMN origin; + +DROP TABLE llx_opensurvey_sujet_studs; + + + +CREATE TABLE llx_opensurvey_formquestions ( + rowid INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, + id_sondage VARCHAR(16), + question TEXT, + available_answers TEXT -- List of available answers +) ENGINE=InnoDB; + +CREATE TABLE llx_opensurvey_user_formanswers ( + fk_user_survey INTEGER NOT NULL, + fk_question INTEGER NOT NULL, + reponses TEXT +) ENGINE=InnoDB; + + diff --git a/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql b/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql new file mode 100644 index 00000000000..cf6b89f1339 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_opensurvey_formquestions.sql @@ -0,0 +1,24 @@ +-- ============================================================================ +-- Copyright (C) 2013 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- ============================================================================ + +CREATE TABLE llx_opensurvey_formquestions ( + rowid INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY, + id_sondage VARCHAR(16), + question TEXT, + available_answers TEXT -- List of available answers +) ENGINE=InnoDB; + diff --git a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql b/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql index dca50aba6f7..16e8a624e72 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_sondage.sql @@ -24,10 +24,10 @@ CREATE TABLE llx_opensurvey_sondage ( fk_user_creat integer NOT NULL, titre TEXT NOT NULL, date_fin DATETIME NOT NULL, - format VARCHAR(2) NOT NULL, + format VARCHAR(2) NOT NULL, -- 'A' = Text choice (choices are saved into sujet field), 'D' = Date choice (choices are saved into sujet field), 'F' = Form survey mailsonde tinyint NOT NULL DEFAULT 0, allow_comments tinyint NOT NULL DEFAULT 1, allow_spy tinyint NOT NULL DEFAULT 1, tms TIMESTAMP, - sujet TEXT -) ENGINE=InnoDB; \ No newline at end of file + sujet TEXT, -- Not filled if format = 'F'. Question are into table llx_opensurvey_formquestions +) ENGINE=InnoDB; diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql new file mode 100644 index 00000000000..8a771604181 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_opensurvey_user_formanswers.sql @@ -0,0 +1,22 @@ +-- ============================================================================ +-- Copyright (C) 2015 Laurent Destailleur +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- ============================================================================ + +CREATE TABLE llx_opensurvey_user_formanswers ( + fk_user_survey INTEGER NOT NULL, + fk_question INTEGER NOT NULL, + reponses TEXT +) ENGINE=InnoDB; diff --git a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql index 78d7fa69c4d..0e918d68a86 100644 --- a/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql +++ b/htdocs/install/mysql/tables/llx_opensurvey_user_studs.sql @@ -19,6 +19,6 @@ CREATE TABLE llx_opensurvey_user_studs ( id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, nom VARCHAR(64) NOT NULL, id_sondage VARCHAR(16) NOT NULL, - reponses VARCHAR(100) NOT NULL, + reponses VARCHAR(100) NOT NULL, -- Not used for 'F' surveys tms timestamp ) ENGINE=InnoDB;