Skip to content

Commit

Permalink
Dev: Add default value 0 to assessment_value
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jan 12, 2018
1 parent 9440abe commit 24cc871
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -13,7 +13,7 @@


$config['versionnumber'] = '3.0.2'; //The current version of this branch, LS3
$config['dbversionnumber'] = 342;
$config['dbversionnumber'] = 343;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '30003';
Expand Down
10 changes: 10 additions & 0 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -936,6 +936,16 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)
$oTransaction->commit();
}

/**
* Column assessment_value not null but default to 0.
*/
if ($iOldDBVersion < 343) {
$oTransaction = $oDB->beginTransaction();
alterColumn('{{answers}}', 'assessment_value', 'integer', false, '0');
$oDB->createCommand()->update('{{settings_global}}', array('stg_value'=>343), "stg_name='DBVersion'");
$oTransaction->commit();
}

} catch (Exception $e) {
Yii::app()->setConfig('Updating', false);
$oTransaction->rollback();
Expand Down
2 changes: 1 addition & 1 deletion installer/create-database.php
Expand Up @@ -30,7 +30,7 @@ function createDatabase($oDB){
'code' => 'string(5) NOT NULL',
'answer' => 'text NOT NULL',
'sortorder' => 'integer NOT NULL',
'assessment_value' => 'integer NOT NULL',
'assessment_value' => 'integer NOT NULL DEFAULT 0',
'language' => "string(20) NOT NULL DEFAULT 'en'",
'scale_id' => 'integer NOT NULL DEFAULT 0',
));
Expand Down

0 comments on commit 24cc871

Please sign in to comment.