Skip to content

Commit

Permalink
Fixed issue: Missing default survey group causing problems after upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Nov 4, 2021
1 parent 8b60555 commit 5bb70eb
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -4167,7 +4167,41 @@ function ($v) {
/* Add public boolean to surveygroup : view forl all in list */
if ($iOldDBVersion < 435) {
$oTransaction = $oDB->beginTransaction();
// Check if default survey groups exists - at some point it was possible to delete it
$defaultSurveyGroupExists = $oDB->createCommand()
->select('gsid')
->from("{{surveys_groups}}")
->where('gsid = 1')
->queryScalar();
if ($defaultSurveyGroupExists == false) {
// Add missing default template
$date = date("Y-m-d H:i:s");
$oDB->createCommand()->insert('{{surveys_groups}}', array(
'gsid' => 1,
'name' => 'default',
'title' => 'Default',
'description' => 'Default survey group',
'sortorder' => '0',
'owner_uid' => '1',
'created' => $date,
'modified' => $date,
'created_by' => '1'
));
}
$oDB->createCommand()->addColumn('{{surveys_groups}}', 'alwaysavailable', "boolean NULL");
$oDB->createCommand()->update(
'{{surveys_groups}}',
array(
'alwaysavailable' => '0',

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Nov 4, 2021

Collaborator

PS : SurveyGroup 1 is forced as alwaysavailable (currently)

)
);
$oDB->createCommand()->update(
'{{surveys_groups}}',
array(
'alwaysavailable' => '0',
),
"gsid=1"
);
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 435), "stg_name='DBVersion'");
$oTransaction->commit();
}
Expand Down

1 comment on commit 5bb70eb

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default surey group was not already created ?

Arg … sorry …

Please sign in to comment.