From 7f78346391249be181d6d03e983c9c5622f571fe Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 5 Jul 2015 12:57:26 +0200 Subject: [PATCH] Dev implemented importing of custom question attributes. --- application/controllers/SurveysController.php | 3 +- application/core/WebApplication.php | 1 + .../helpers/import/BaseElementXmlImport.php | 8 + application/helpers/import/BaseImport.php | 3 + .../helpers/import/importers/Import178.php | 20 +- application/models/Question.php | 193 ++++++++++++------ application/models/QuestionAttribute.php | 25 +-- application/models/Survey.php | 3 + application/models/Token.php | 7 +- application/views/global/surveyNavigator.php | 2 +- .../views/questions/update/routing.php | 2 +- .../views/questions/update/statistics.php | 2 +- .../views/questions/update/validation.php | 12 +- installer/sql/create-mysql.sql | 66 +++--- 14 files changed, 215 insertions(+), 132 deletions(-) diff --git a/application/controllers/SurveysController.php b/application/controllers/SurveysController.php index c08d9faaceb..437bfac6e87 100644 --- a/application/controllers/SurveysController.php +++ b/application/controllers/SurveysController.php @@ -216,7 +216,8 @@ public function actionImport() { if (isset($file)) { $importer = ImportFactory::getForLss($file->getTempName()); if (null !== $survey = $importer->run()) { - App()->user->setFlash('success', "Survey imported."); + + App()->user->setFlash('success', "Survey imported ({$survey->groupCount}/{$survey->questionCount})."); $this->redirect(['surveys/update', 'id' => $survey->primaryKey]); } else { App()->user->setFlash('error', "Survey not imported."); diff --git a/application/core/WebApplication.php b/application/core/WebApplication.php index 8416a87b56a..92869a59950 100644 --- a/application/core/WebApplication.php +++ b/application/core/WebApplication.php @@ -29,6 +29,7 @@ * @property CHttpSession $session * @property CClientScript $clientScript * @property MigrationManager $migrationManager + * @property CSecurityManager $securityManager */ class WebApplication extends CWebApplication { diff --git a/application/helpers/import/BaseElementXmlImport.php b/application/helpers/import/BaseElementXmlImport.php index 0694ea40992..bab76bfafed 100644 --- a/application/helpers/import/BaseElementXmlImport.php +++ b/application/helpers/import/BaseElementXmlImport.php @@ -106,6 +106,13 @@ protected function constructQuestion($question, $language, $data) } } + // Add attributes + foreach (isset($data['question_attributes']) ? $data['question_attributes']['rows'] : [] as $attribute) { + if ($attribute['qid'] == $question['qid']) { + $question[$attribute['attribute']] = $attribute['value']; + } + } + return $question; } @@ -132,6 +139,7 @@ protected function constructGroup($group, $language, $data) { foreach($data['questions']['rows'] as $question) { // Only handle the base language. if ($question['gid'] == $group['gid'] && $question['language'] == $language) { + $group['questions'][] = $this->constructQuestion($question, $language, $data); } diff --git a/application/helpers/import/BaseImport.php b/application/helpers/import/BaseImport.php index f3ddedd0747..13119986be4 100644 --- a/application/helpers/import/BaseImport.php +++ b/application/helpers/import/BaseImport.php @@ -5,6 +5,9 @@ public function __construct() {} abstract public function setSource($file); + /** + * @return \Survey + */ abstract public function run(); diff --git a/application/helpers/import/importers/Import178.php b/application/helpers/import/importers/Import178.php index ca2174636a1..101a02ecfaf 100644 --- a/application/helpers/import/importers/Import178.php +++ b/application/helpers/import/importers/Import178.php @@ -25,7 +25,6 @@ public function run() $transaction = App()->db->beginTransaction(); try { - $groupMap = []; /** @var \Survey $survey */ $result = $this->importSurvey($this->parsedDocument); } catch(\Exception $e) { @@ -47,11 +46,12 @@ protected function importTranslation(TranslatableBehavior $translatable, array $ $translatedFields = []; foreach ($translatable->attributes as $attribute) { if (isset($data[$attribute])) { - $translatedFields = $data[$attribute]; + $translatedFields[$attribute] = $data[$attribute]; } } if (!empty($translatedFields)) { $translation = new \Translation(); + $translation->language = $data['language']; $translation->model = $translatable->getModel(); $translation->model_id = $translatable->owner->primaryKey; $translation->dataStore = $translatedFields; @@ -173,24 +173,26 @@ protected function importQuestion(array $data, \QuestionGroup $group, array &$qu /** * If we only have 1 language, use it even if it is not the "base" language. */ - if (count($data) == 1 && isset($data['translations']) && count($data['translations']) == 1) { - $data = $data['translations'][0]; - } $translations = \TbArray::popValue('translations', $data, []); $subQuestions = \TbArray::popValue('subquestions', $data, []); $conditions = \TbArray::popValue('conditions', $data, []); $answers = \TbArray::popValue('answers', $data, []); $data = $this->prepareQuestion($data, $group, $parent); - $question = new \Question(); + // We want the "correct class". + $class = \Question::resolveClass($data['type']); + /** @var \Question $question */ + $question = new $class(); + $question->type = $data['type']; foreach($data as $key => $value) { if (!($question->canSetProperty($key) || $question->hasAttribute($key))) { - throw new \Exception("Could not set property $key"); + throw new \Exception("Could not set property $key for " . get_class($question)); + } else { + $question->$key = $value; } } - $question->setAttributes($data, false); $oldKey = $question->primaryKey; $question->primaryKey = null; - $question->parent_qid = !isset($parent) ? 0 : $parent->qid; + $question->parent_qid = !isset($parent) ? 0 : $parent->primaryKey; if ($result = $question->save()) { $question->group = $group; diff --git a/application/models/Question.php b/application/models/Question.php index 1a07657f235..af62d4eaf6d 100644 --- a/application/models/Question.php +++ b/application/models/Question.php @@ -22,15 +22,73 @@ * @property-read Translation[] $translations Relation added by translatable behavior * @property-read bool $hasSubQuestions * @property-read bool $hasAnswers + * @property-read string $type * @property QuestionGroup $group; * @property string $title * @property-read Survey $survey + * @property-read QuestionAttribute[] $questionAttributes */ class Question extends LSActiveRecord { - + protected $customAttributes = []; public $before; + protected function afterFind() + { + parent::afterFind(); + // Fill the question attributes. + foreach($this->questionAttributes as $questionAttribute) { + if (!isset($questionAttribute->language)) { + $this->customAttributes[$questionAttribute->attribute] = $questionAttribute; + } + + } + } + + protected function afterSave() + { + parent::afterSave(); + $this->updateAttributes(); + + } + + protected function updateAttributes() { + // Save the question attributes that do not use i18n. + $db = self::getDbConnection(); + if (!isset($db->currentTransaction)) { + $transaction = $db->beginTransaction(); + } + try { + QuestionAttribute::model()->deleteAllByAttributes([ + 'qid' => $this->primaryKey, + 'language' => null + + ]); + $rows = []; + foreach ($this->customAttributes as $key => $value) { + $rows[] = [ + 'attribute' => $key, + 'value' => $value, + 'language' => null + ]; + } + if (!empty($rows)) { + $db->commandBuilder->createMultipleInsertCommand(QuestionAttribute::model()->tableName(), + $rows)->execute(); + } + } catch (\Exception $e) { + if (isset($transaction)) { + $transaction->rollback(); + } + throw $e; + } + if (isset($transaction)) { + $transaction->commit(); + } + + } + + public function getHasSubQuestions() { return false; @@ -58,19 +116,6 @@ public function behaviors() { ]; } - /** - * Returns the static model of Settings table - * - * @static - * @access public - * @param string $class - * @return CActiveRecord - */ - public static function model($class = __CLASS__) - { - return parent::model($class); - } - public function beforeSave() { if ($this->isNewRecord && empty($this->parent_qid) && empty($this->question_order)) { // Set order. @@ -108,8 +153,8 @@ public function __get($name) { if (substr($name, 0, 5) == 'bool_') { $result = parent::__get(substr($name, 5)) === 'Y'; - } elseif (substr($name, 0, 2) == 'a_') { - $result = isset($this->questionAttributes[substr($name, 2)]) ? $this->questionAttributes[substr($name, 2)]->value : null; + } elseif ($name != 'type' && in_array($name, $this->customAttributeNames())) { + $result = isset($this->customAttributes[$name]) ? $this->customAttributes[$name] : null; } else { $result = parent::__get($name); } @@ -120,14 +165,8 @@ public function __set($name, $value) { if (substr($name, 0, 5) == 'bool_') { parent::__set(substr($name, 5), $value ? 'Y' : 'N'); - } elseif (substr($name, 0, 2) == 'a_') { - throw new \Exception("Saving not yet supported"); - /** - * Several implementation options: - * 1. Save to database on set. (Bad because the record might not get saved.) - * 2. Save to memory, watch before/after Save and commit to db then. (Better but loses atomicity). - * 3. Save to memory, override save and use a transaction. - */ + } elseif (in_array($name, $this->customAttributeNames())) { + $this->customAttributes[$name] = $value; } else { parent::__set($name, $value); @@ -288,7 +327,9 @@ public function getAdvancedSettingsWithValues($iQuestionID, $sQuestionType, $iSu if ($iQuestionID) { - $oAttributeValues = QuestionAttribute::model()->findAll("qid=:qid",array('qid'=>$iQuestionID)); + $oAttributeValues = QuestionAttribute::model()->findAllByAttributes([ + 'qid' => $iQuestionID + ]); $aAttributeValues=array(); foreach($oAttributeValues as $oAttributeValue) { @@ -817,47 +858,52 @@ protected function instantiate($attributes) { if (!empty($attributes['parent_qid'])) { $class = \ls\models\questions\SubQuestion::class; } else { - switch ($attributes['type']) { - case 'N': - $class = \ls\models\questions\NumericalQuestion::class; - break; - case 'D': // Date time - case 'U': // Huge free text - case 'S': // Short free text - case 'T': - $class = \ls\models\questions\TextQuestion::class; - break; - case 'O': // Single choice with comments. - case '!': // Single choice dropdown. - case 'L': // Single choice (Radio); - $class = \ls\models\questions\SingleChoiceQuestion::class; - break; - case 'Q': // Multiple (short) text. - $class = \ls\models\questions\MultipleTextQuestion::class; - break; - case 'R': // Ranking - $class = \ls\models\questions\RankingQuestion::class; - break; - case 'F': // Array - $class = \ls\models\questions\ArrayQuestion::class; - break; - case '5': // 5 point choice - case 'Y': // Yes no - case '|': - case 'X': // Text display - $class = get_class($this); - break; - case 'M': // Multiple choice - $class = \ls\models\questions\MultipleChoiceQuestion::class; - break; - default: - die("noo class for type {$attributes['type']}"); - - } + $class = self::resolveClass($attributes['type']); } return new $class(null); } + public static function resolveClass($type) { + switch ($type) { + case 'N': + $class = \ls\models\questions\NumericalQuestion::class; + break; + case 'D': // Date time + case 'U': // Huge free text + case 'S': // Short free text + case 'T': + $class = \ls\models\questions\TextQuestion::class; + break; + case 'O': // Single choice with comments. + case '!': // Single choice dropdown. + case 'L': // Single choice (Radio); + $class = \ls\models\questions\SingleChoiceQuestion::class; + break; + case 'Q': // Multiple (short) text. + $class = \ls\models\questions\MultipleTextQuestion::class; + break; + case 'R': // Ranking + $class = \ls\models\questions\RankingQuestion::class; + break; + case 'F': // Array + $class = \ls\models\questions\ArrayQuestion::class; + break; + case '5': // 5 point choice + case 'Y': // Yes no + case '|': + case 'X': // Text display + $class = __CLASS__; + break; + case 'M': // Multiple choice + $class = \ls\models\questions\MultipleChoiceQuestion::class; + break; + default: + die("noo class for type {$type}"); + + } + return $class; + } + public function getTypeName() { return $this->typeList()[$this->type]['description']; } @@ -914,9 +960,26 @@ public function deleteDependent() { } } + /** + * Returns the question attributes that do use i18n. + * @return string[] + */ + public function customAttributeNames() { + if (isset($this->type)) { + $attributes = array_filter(questionAttributes()[$this->type], function ($attribute) { + return $attribute['i18n'] === false; + }); + $result = array_keys($attributes); + } else { + $result = []; + } + return $result; + } - } - + public function hasAttribute($name) + { + return in_array($name, $this->customAttributeNames()) || parent::hasAttribute($name); + } -?> + } diff --git a/application/models/QuestionAttribute.php b/application/models/QuestionAttribute.php index 103d5cb2e3b..0056d371d36 100644 --- a/application/models/QuestionAttribute.php +++ b/application/models/QuestionAttribute.php @@ -13,6 +13,12 @@ * Files Purpose: lots of common functions */ +/** + * Class QuestionAttribute + * @property string $language + * @property string $attribute + * @property string $value + */ class QuestionAttribute extends LSActiveRecord { /** @@ -39,16 +45,6 @@ public function tableName() return '{{question_attributes}}'; } - /** - * Returns the primary key of this table - * - * @access public - * @return string - */ - public function primaryKey() - { - return 'qaid'; - } /** * Defines the relations for this model @@ -58,12 +54,9 @@ public function primaryKey() */ public function relations() { - $alias = $this->getTableAlias(); - return array( - 'qid' => array(self::HAS_ONE, 'Questions', '', - 'on' => "$alias.qid = questions.qid", - ), - ); + return [ + 'qid' => [self::BELONGS_TO, Question::class, 'qid'] + ]; } /** diff --git a/application/models/Survey.php b/application/models/Survey.php index 7980274065d..a7f456c4d59 100644 --- a/application/models/Survey.php +++ b/application/models/Survey.php @@ -22,6 +22,8 @@ * @property-read QuestionGroup[] $groups * @property string $admin * @property string $adminEmail + * @property-read int $questionCount + * @property-read int $groupCount */ class Survey extends LSActiveRecord { @@ -170,6 +172,7 @@ public function relations() 'groups' => [self::HAS_MANY, 'QuestionGroup', 'sid', 'order' => 'group_order ASC'], 'questions' => [self::HAS_MANY, 'Question', 'sid', 'on' => "questions.parent_qid = 0", 'order' => 'question_order ASC'], 'questionCount' => [self::STAT, 'Question', 'sid', 'condition' => "parent_qid = 0"], + 'groupCount' => [self::STAT, QuestionGroup::class, 'sid'], 'savedControls' => [self::HAS_MANY, SavedControl::class, 'sid'], 'surveyLinks' => [self::HAS_MANY, SurveyLink::class, 'survey_id'], 'quota' => [self::HAS_MANY, Quota::class, 'sid'] diff --git a/application/models/Token.php b/application/models/Token.php index 3fc6f1c0749..64cde8d6e0e 100644 --- a/application/models/Token.php +++ b/application/models/Token.php @@ -170,6 +170,11 @@ public function generateTokens() { if ($this->scenario != '') { throw new \Exception("This function should only be called like: Token::model(12345)->generateTokens"); } + /** + * @todo Generate tokens in SQL. + */ + //$sql = "SUBSTRING(CONCAT(MD5(RAND()), MD5(RAND())), 1, 15)"; + $surveyId = $this->dynamicId; $tokenLength = isset($this->survey) && is_numeric($this->survey->tokenlength) ? $this->survey->tokenlength : 15; @@ -198,7 +203,7 @@ public function generateTokens() { $bIsValidToken = false; while ($bIsValidToken == false && $invalidtokencount<50) { - $newtoken = Yii::app()->securityManager->generateRandomString($tokenLength); + $newtoken = App()->securityManager->generateRandomString($tokenLength); if (!isset($existingtokens[$newtoken])) { $existingtokens[$newtoken] = true; diff --git a/application/views/global/surveyNavigator.php b/application/views/global/surveyNavigator.php index 99667cfb5cf..f69132e9592 100644 --- a/application/views/global/surveyNavigator.php +++ b/application/views/global/surveyNavigator.php @@ -5,7 +5,7 @@ /** @var QuestionGroup $group */ foreach ($survey->groups as $group) { $items[] = [ - 'label' => "{$group->title} - {$group->description}", + 'label' => $group->title, 'url' => ['groups/view', 'id' => $group->id], 'class' => 'group', 'active' => isset($this->group) && $this->group->id === $group->id && !isset($this->question) diff --git a/application/views/questions/update/routing.php b/application/views/questions/update/routing.php index 0b01d0f9056..b9073186d59 100644 --- a/application/views/questions/update/routing.php +++ b/application/views/questions/update/routing.php @@ -4,7 +4,7 @@ echo TbHtml::openTag('fieldset', []); echo $form->textFieldControlGroup($question, 'title'); echo $form->textFieldControlGroup($question, 'relevance'); -echo $form->textFieldControlGroup($question, 'a_random_group'); +echo $form->textFieldControlGroup($question, 'random_group'); echo $form->checkBoxControlGroup($question, 'bool_mandatory'); echo TbHtml::closeTag('fieldset'); ?> \ No newline at end of file diff --git a/application/views/questions/update/statistics.php b/application/views/questions/update/statistics.php index 7e8398e826b..281a9633dfe 100644 --- a/application/views/questions/update/statistics.php +++ b/application/views/questions/update/statistics.php @@ -2,7 +2,7 @@ // This is an update view so we use PUT. echo TbHtml::well('This is not used yet.'); echo TbHtml::openTag('fieldset', []); -echo $form->dropDownListControlGroup($question, 'a_statistics_graphtype', [ +echo $form->dropDownListControlGroup($question, 'statistics_graphtype', [ 0 => gT('Bar chart'), 1 => gT('Pie chart') ], ['empty' => gT("No graph")]); diff --git a/application/views/questions/update/validation.php b/application/views/questions/update/validation.php index d9da0740586..045893307f9 100644 --- a/application/views/questions/update/validation.php +++ b/application/views/questions/update/validation.php @@ -1,9 +1,13 @@ textFieldControlGroup($question, 'preg'); -echo $form->textFieldControlGroup($question, 'a_validation_q'); -echo $form->textFieldControlGroup($question, 'a_validation_q_tip'); -echo $form->textFieldControlGroup($question, 'a_validation_sq'); -echo $form->textFieldControlGroup($question, 'a_validation_sq_tip'); +echo $form->textFieldControlGroup($question, 'em_validation_q'); +echo $form->textFieldControlGroup($question, 'em_validation_q_tip'); + +if ($question->hasAttribute('validation_sq')) { + echo $form->textFieldControlGroup($question, 'validation_sq'); + echo $form->textFieldControlGroup($question, 'validation_sq_tip'); +} echo TbHtml::closeTag('fieldset'); \ No newline at end of file diff --git a/installer/sql/create-mysql.sql b/installer/sql/create-mysql.sql index e34a238754a..eecf925ae4c 100644 --- a/installer/sql/create-mysql.sql +++ b/installer/sql/create-mysql.sql @@ -10,7 +10,7 @@ CREATE TABLE `prefix_answers` ( `language` varchar(20) default 'en', `scale_id` int(11) NOT NULL default '0', PRIMARY KEY (`qid`,`code`,`language`,`scale_id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -27,7 +27,7 @@ CREATE TABLE `prefix_assessments` ( `message` text NOT NULL, `language` varchar(20) NOT NULL default 'en', PRIMARY KEY (`id`,`language`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -42,7 +42,7 @@ CREATE TABLE `prefix_conditions` ( `value` varchar(255) NOT NULL default '', `scenario` int(11) NOT NULL default '1', PRIMARY KEY (`cid`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -56,7 +56,7 @@ CREATE TABLE `prefix_defaultvalues` ( `specialtype` varchar(20) NOT NULL default '', `defaultvalue` text, PRIMARY KEY (`qid`, `specialtype`, `language`, `scale_id`, `sqid`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -74,7 +74,7 @@ CREATE TABLE `prefix_expression_errors` ( `eqn` text, `prettyprint` text, PRIMARY KEY (`id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -86,7 +86,7 @@ CREATE TABLE `prefix_failed_login_attempts` ( `last_attempt` varchar(20) NOT NULL, `number_attempts` int(11) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -102,7 +102,7 @@ CREATE TABLE `prefix_groups` ( `randomization_group` varchar(20) NOT NULL default '', `grelevance` text DEFAULT NULL, PRIMARY KEY (`gid`,`language`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -117,7 +117,7 @@ CREATE TABLE `prefix_labels` ( `assessment_value` int(11) NOT NULL default '0', PRIMARY KEY (`lid`,`sortorder`,`language`), KEY `labels_code_idx` (`code`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -128,7 +128,7 @@ CREATE TABLE `prefix_labelsets` ( `label_name` varchar(100) NOT NULL default '', `languages` varchar(200) default 'en', PRIMARY KEY (`lid`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -139,7 +139,7 @@ CREATE TABLE `prefix_participant_attribute` ( `attribute_id` int(11) NOT NULL, `value` text NOT NULL, PRIMARY KEY (`participant_id`,`attribute_id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -150,7 +150,7 @@ CREATE TABLE `prefix_participant_attribute_names_lang` ( `attribute_name` varchar(30) NOT NULL, `lang` varchar(255) NOT NULL, PRIMARY KEY (`attribute_id`,`lang`) - ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; + ) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -162,7 +162,7 @@ CREATE TABLE `prefix_participant_attribute_names` ( `defaultname` varchar(50) NOT NULL, `visible` varchar(5) NOT NULL, PRIMARY KEY (`attribute_id`,`attribute_type`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -173,7 +173,7 @@ CREATE TABLE `prefix_participant_attribute_values` ( `attribute_id` int(11) NOT NULL, `value` text NOT NULL, PRIMARY KEY (`value_id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -185,7 +185,7 @@ CREATE TABLE `prefix_participant_shares` ( `date_added` datetime NOT NULL, `can_edit` varchar(5) NOT NULL, PRIMARY KEY (`participant_id`,`share_uid`) - ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; + ) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -203,7 +203,7 @@ CREATE TABLE `prefix_participants` ( `created` datetime, `modified` datetime, PRIMARY KEY (`participant_id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -223,7 +223,7 @@ CREATE TABLE `prefix_permissions` ( `export_p` int(11) NOT NULL default '0', PRIMARY KEY (`id`), UNIQUE KEY `idxPermissions` (`entity_id`,`entity`,`permission`,`uid`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -234,7 +234,7 @@ CREATE TABLE `prefix_plugins` ( `name` varchar(50) NOT NULL, `active` int(1) NOT NULL default '0', PRIMARY KEY (`id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -248,7 +248,7 @@ CREATE TABLE `prefix_plugin_settings` ( `key` varchar(50) NOT NULL, `value` text NULL, PRIMARY KEY (`id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -261,7 +261,7 @@ CREATE TABLE `prefix_question_attributes` ( `value` text default NULL, `language` varchar(20) default NULL, PRIMARY KEY (`qaid`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -285,7 +285,7 @@ CREATE TABLE `prefix_questions` ( `same_default` int(11) NOT NULL default '0' COMMENT 'Saves if user set to use the same default value across languages in default options dialog', `relevance` text, PRIMARY KEY (`qid`,`language`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -300,7 +300,7 @@ CREATE TABLE `prefix_quota` ( `active` int(11) NOT NULL default '1', `autoload_url` int(11) NOT NULL default '0', PRIMARY KEY (`id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -315,7 +315,7 @@ CREATE TABLE `prefix_quota_languagesettings` ( `quotals_url` varchar(255), `quotals_urldescrip` varchar(255), PRIMARY KEY (`quotals_id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -329,7 +329,7 @@ CREATE TABLE `prefix_quota_members` ( `code` varchar(11) collate utf8_unicode_ci default NULL, PRIMARY KEY (`id`), UNIQUE KEY `sid` (`sid`,`qid`,`quota_id`,`code`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -348,7 +348,7 @@ CREATE TABLE `prefix_saved_control` ( `saved_date` datetime NOT NULL, `refurl` text, PRIMARY KEY (`scid`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -359,7 +359,7 @@ CREATE TABLE `prefix_sessions`( `expire` int(11) DEFAULT NULL, `data` longblob, PRIMARY KEY (`id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -369,7 +369,7 @@ CREATE TABLE `prefix_settings_global` ( `stg_name` varchar(50) NOT NULL default '', `stg_value` varchar(255) NOT NULL default '', PRIMARY KEY (`stg_name`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -383,7 +383,7 @@ CREATE TABLE `prefix_survey_links` ( `date_invited` datetime, `date_completed` datetime, PRIMARY KEY (`participant_id`,`token_id`,`survey_id`) - ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; + ) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -396,7 +396,7 @@ CREATE TABLE `prefix_survey_url_parameters` ( `targetqid` int(11) NULL, `targetsqid` int(11) NULL, PRIMARY KEY (`id`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -462,7 +462,7 @@ CREATE TABLE `prefix_surveys` ( `googleanalyticsstyle` varchar(1) DEFAULT NULL, `googleanalyticsapikey` VARCHAR(25) DEFAULT NULL, PRIMARY KEY (`sid`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -507,7 +507,7 @@ CREATE TABLE `prefix_user_groups` ( `owner_id` int(11) NOT NULL, PRIMARY KEY (`ugid`), UNIQUE KEY `lug_name` (`name`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -517,7 +517,7 @@ CREATE TABLE `prefix_user_in_groups` ( `ugid` int(11) NOT NULL, `uid` int(11) NOT NULL, PRIMARY KEY (`ugid`,`uid`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -540,7 +540,7 @@ CREATE TABLE `prefix_users` ( `modified` datetime, PRIMARY KEY (`uid`), UNIQUE KEY `users_name` (`users_name`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; -- @@ -550,7 +550,7 @@ CREATE TABLE `prefix_templates` ( `folder` varchar(255) NOT NULL, `creator` int(11) NOT NULL, PRIMARY KEY (`folder`) -) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci; +) ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci; --