Skip to content

Commit

Permalink
Dev: small text change, updatedb logic for inheritance of ipanonymiza…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
Trischi80 committed Apr 15, 2020
1 parent c30b51c commit ff3ee42
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -3068,11 +3068,19 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)
}
if($iOldDBVersion < 426){
$oTransaction = $oDB->beginTransaction();

$oDB->createCommand()->addColumn('{{surveys_groupsettings}}', 'ipanonymize', "string(1) NULL default 'N'");
//change gsid=0 and gsid=1 for inheritance logic ...
$oDB->createCommand()->update('{{surveys_groupsettings}}',array('ipanonymize' => 'N'), 'gsid=1');
$oDB->createCommand()->update('{{surveys_groupsettings}}',array('ipanonymize' => 'I'), 'gsid=0');
$oDB->createCommand()->addColumn('{{surveys}}', 'ipanonymize', "string(1) NULL default 'N'");

//all groups (except default group gsid=0), must have inheritance value
$oDB->createCommand()->update('{{surveys_groupsettings}}',array('ipanonymize' => 'I'), 'gsid<>0');

//change gsid=1 for inheritance logic ...(redundant, but for better understanding and securit)
$oDB->createCommand()->update('{{surveys_groupsettings}}',array('ipanonymize' => 'I'), 'gsid=1');

//for all non active surveys,the value must be "I" for inheritance ...
$oDB->createCommand()->update('{{surveys}}', array('ipanonymize' => 'I'), "active='N'");

$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 426), "stg_name='DBVersion'");
$oTransaction->commit();
}
Expand Down

0 comments on commit ff3ee42

Please sign in to comment.