Skip to content

Commit

Permalink
Dev: few changed in DB + Update DB number so tester can update
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jul 17, 2017
1 parent 267c097 commit 853f1df
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Original file line number Diff line number Diff line change
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'] = 296;
$config['dbversionnumber'] = 297;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '2671';
Expand Down
34 changes: 16 additions & 18 deletions application/helpers/update/updatedb_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,13 @@ function db_upgrade_all($iOldDBVersion, $bSilent=false) {
$oTransaction->commit();
}

/**
* Template tables
* @since 2017-07-12
*/
if ($iOldDBVersion < 295) {
$oTransaction = $oDB->beginTransaction();
upgradeTemplateTables295($oDB);
$oTransaction->commit();
}

/**
* Survey menue table update
* @since 2017-07-12
*/
if ($iOldDBVersion < 296) {
$oTransaction = $oDB->beginTransaction();

$oDB->createCommand()->addColumn('{{surveymenu}}', 'user_id', "int DEFAULT NULL");
$oDB->createCommand()->addForeignKey('user_id', '{{surveymenu}}', 'user_id', '{{users}}', 'uid' );
$oDB->createCommand()->addColumn('{{surveymenu_entries}}', 'user_id', "int DEFAULT NULL");
Expand Down Expand Up @@ -276,10 +266,22 @@ function db_upgrade_all($iOldDBVersion, $bSilent=false) {
$oDB->createCommand()->insert('{{surveymenu_entries}}', $combined);
}

$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>296),"stg_name='DBVersion'");


$oTransaction->commit();
}

/**
* Template tables
* @since 2017-07-12
*/
if ($iOldDBVersion < 297) {
$oTransaction = $oDB->beginTransaction();
upgradeTemplateTables297($oDB);
$oTransaction->commit();
$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>297),"stg_name='DBVersion'");
}

}
catch(Exception $e)
{
Expand Down Expand Up @@ -408,7 +410,7 @@ function createSurveyMenuTable293($oDB) {
* @param $oDB
* @return void
*/
function upgradeTemplateTables295($oDB)
function upgradeTemplateTables297($oDB)
{
// Drop the old survey rights table.
if (tableExists('{templates}')) {
Expand Down Expand Up @@ -457,7 +459,6 @@ function upgradeTemplateTables295($oDB)
'view_folder' => 'views',
'files_folder' => 'files',
'description' => 'LimeSurvey Advanced Template:\r\nMany options for user customizations. \r\n',
// 'last_update' => '',
'owner_id' => '1',
'extends_templates_name' => '',
));
Expand All @@ -468,6 +469,7 @@ function upgradeTemplateTables295($oDB)
'templates_name' => 'string(150) NOT NULL',
'sid' => 'int(11) DEFAULT NULL',
'gsid' => 'int(11) DEFAULT NULL',
'uid' => 'int(11) DEFAULT NULL',
'files_css' => 'MEDIUMTEXT',
'files_js' => 'MEDIUMTEXT',
'files_print_css' => 'MEDIUMTEXT',
Expand All @@ -492,12 +494,8 @@ function upgradeTemplateTables295($oDB)
'packages_to_load' => 'template-core,',
));

$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>295),"stg_name='DBVersion'");
}




function fixLanguageConsistencyAllSurveys()
{
$surveyidquery = "SELECT sid,additional_languages FROM ".dbQuoteID('{{surveys}}');
Expand Down
3 changes: 2 additions & 1 deletion installer/sql/create-mysql.sql
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ CREATE TABLE `prefix_surveymenu_entries` (
KEY `menu_title` (`menu_title`(191))
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `prefix_surveymenu_entries` VALUES
INSERT INTO `prefix_surveymenu_entries` VALUES
(1,1,NULL,1,'overview','Survey overview','Overview','Open general survey overview and quick action','list','fontawesome','','admin/survey/sa/view','','','','','','',NULL,'','en-GB',NOW(),0,NOW(),0),
(2,1,NULL,2,'generalsettings','Edit survey general settings','General settings','Open general survey settings','gears','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/accordion/_generaloptions_panel','','surveysettings','read',NULL,'_generalTabEditSurvey','en-GB',NOW(),0,NOW(),0),
(3,1,NULL,3,'surveytexts','Edit survey text elements','Survey texts','Edit survey text elements','file-text-o','fontawesome','','','updatesurveylocalesettings','editLocalSettings_main_view','/admin/survey/subview/tab_edit_view','','surveylocale','read',NULL,'_getTextEditData','en-GB',NOW(),0,NOW(),0),
Expand Down Expand Up @@ -749,6 +749,7 @@ CREATE TABLE `lime_template_configuration` (
`templates_name` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`sid` int(11) DEFAULT NULL,
`gsid` int(11) DEFAULT NULL,
`uid` int(11) DEFAULT NULL,
`files_css` mediumtext COLLATE utf8mb4_unicode_ci,
`files_js` mediumtext COLLATE utf8mb4_unicode_ci,
`files_print_css` mediumtext COLLATE utf8mb4_unicode_ci,
Expand Down

0 comments on commit 853f1df

Please sign in to comment.