Skip to content

Commit

Permalink
Dev: few fixes on upgradeDB
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jul 12, 2017
1 parent eb945f7 commit 16f2a7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -13,7 +13,7 @@

$config['versionnumber'] = '3.0.0-alpha'; //The current version of this branch
$config['masterversion'] = '2.62.2'; //The current masters version merged into this branch
$config['dbversionnumber'] = 294;
$config['dbversionnumber'] = 295;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '2671';
Expand Down
17 changes: 8 additions & 9 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -21,7 +21,6 @@
* @param boolean $bSilent Run update silently with no output - this checks if the update can be run silently at all. If not it will not run any updates at all.
*/
function db_upgrade_all($iOldDBVersion, $bSilent=false) {

/**
* If you add a new database version add any critical database version numbers to this array. See link
* @link https://manual.limesurvey.org/Database_versioning for explanations
Expand Down Expand Up @@ -234,7 +233,8 @@ function db_upgrade_all($iOldDBVersion, $bSilent=false) {
* @since 2017-07-12
*/
if ($iOldDBVersion < 295) {
upgradeTemplateTables295();
$oTransaction = $oDB->beginTransaction();
upgradeTemplateTables295($oDB);
}

}
Expand Down Expand Up @@ -361,9 +361,7 @@ function createSurveyMenuTable293($oDB) {
}
}

function upgradeTemplateTables295(){

$oTransaction = $oDB->beginTransaction();
function upgradeTemplateTables295($oDB){

// drop the old survey rights table
$oDB->createCommand()->dropTable('{{templates}}');
Expand All @@ -373,7 +371,7 @@ function upgradeTemplateTables295(){
'name' => 'string(150) NOT NULL',
'folder' => 'string(45) DEFAULT NULL',
'title' => 'string(100) NOT NULL',
'creation_date' => 'DATE DEFAULT NULL',
'creation_date' => 'DATETIME DEFAULT CURRENT_TIMESTAMP',
'author' => 'string(150) DEFAULT NULL',
'author_email' => 'string DEFAULT NULL',
'author_url' => 'string DEFAULT NULL',
Expand All @@ -384,7 +382,7 @@ function upgradeTemplateTables295(){
'view_folder' => 'string(45) DEFAULT NULL',
'files_folder' => 'string(45) DEFAULT NULL',
'description' => 'TEXT',
'last_update' => 'DATE DEFAULT NULL',
'last_update' => 'DATETIME DEFAULT CURRENT_TIMESTAMP',
'owner_id' => 'INT(11) DEFAULT NULL',
'extends_templates_name' => 'string(150) DEFAULT NULL',
'PRIMARY KEY (name)'
Expand All @@ -395,7 +393,7 @@ function upgradeTemplateTables295(){
'name' => 'default',
'folder' => 'default',
'title' => 'Advanced Template',
'creation_date' => '2017-07-11',
'creation_date' => '2017-07-12 12:00:00',
'author' => 'Louis Gac',
'author_email' => 'louis.gac@limesurvey.org',
'author_url' => 'https://www.limesurvey.org/',
Expand All @@ -406,7 +404,7 @@ function upgradeTemplateTables295(){
'view_folder' => 'views',
'files_folder' => 'files',
'description' => 'LimeSurvey Advanced Template:\r\nMany options for user customizations. \r\n',
'last_update' => '',
// 'last_update' => '',
'owner_id' => '1',
'extends_templates_name' => '',
));
Expand All @@ -432,6 +430,7 @@ function upgradeTemplateTables295(){

// Add global configuration for Advanced Template
$oDB->createCommand()->insert('{{template_configuration}}', array(
'id' => '1',
'templates_name' => 'default',
'files_css' => '{\r\n"add": ["css/template.css", "css/animate.css"]\r\n}',
'files_js' => '{\r\n"add": ["scripts/template.js"]\r\n}',
Expand Down

0 comments on commit 16f2a7f

Please sign in to comment.