Moodle
  1. Moodle
  2. MDL-32595

Upgrade from 2.2 to 2.3dev has issues with default values

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Database SQL/XMLDB
    • Labels:
    • Testing Instructions:
      Hide

      Adding instructions here based on description.
      use - MySQL 5.0.26
      1) upgrade from 2.2 to the latest version of 2.3dev (Build: 20120419)
      2) As part of the upgrade \lib\db\upgradelib should not run into several issues.

      Show
      Adding instructions here based on description. use - MySQL 5.0.26 1) upgrade from 2.2 to the latest version of 2.3dev (Build: 20120419) 2) As part of the upgrade \lib\db\upgradelib should not run into several issues.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w18_MDL-32595_m23_unsignedandlob
    • Rank:
      39517

      Description

      I have upgraded from 2.2 to the latest version of 2.3dev (Build: 20120419)

      As part of the upgrade \lib\db\upgradelib ran into several issues.

      In the function upgrade_mysql_fix_unsigned_columns when a column is unsigned it changes it to signed and tries to set a default value of ''. This failed when the column is of type int. (I removed the default value but ran into issues later as no default has been set)

      Also the function upgrade_mysql_fix_lob_columns is failing for a similar reason when trying to set a default value.

      I am running MySQL 5.0.26

        Activity

        Hide
        Petr Škoda added a comment -

        Hello, which column tries to set that invalid default? There should not be any of these, when did you install your Moodle (first version)?

        Show
        Petr Škoda added a comment - Hello, which column tries to set that invalid default? There should not be any of these, when did you install your Moodle (first version)?
        Hide
        Petr Škoda added a comment -

        I have tried to play a bit more with MySQL and I think the linked patch on github should resolve it. Could you please try if it works for you? If you do not know how to use git here is a download link with zip package https://github.com/skodak/moodle/zipball/w17_MDL-32595_m23_unsignedandlob

        Show
        Petr Škoda added a comment - I have tried to play a bit more with MySQL and I think the linked patch on github should resolve it. Could you please try if it works for you? If you do not know how to use git here is a download link with zip package https://github.com/skodak/moodle/zipball/w17_MDL-32595_m23_unsignedandlob
        Hide
        Matthew Cannings added a comment - - edited

        Hi Petr,
        It occurred in one of the lesson tables initially but I believe also appeared elsewhere. Unfortunately I changed some of the code (line 76) to not set a default value in order to complete the upgrade so it will have skipped through some of the tables that could have had an issue.

        I will go through the upgrade again later and do a proper check and log the problems and let you know exactly what is happening and whether the patch has worked.

        The server has been upgraded from 1.5 through to 2.2+ (I think it has been 1.5->1.6->1.7->1.9->2.0->2.2)

        I tried to run the query in MySQL but for integer values it would not accept '' as a default. If I placed -1 or 0 in then the installer would continue but stopped on the next integer value in the table.

        Show
        Matthew Cannings added a comment - - edited Hi Petr, It occurred in one of the lesson tables initially but I believe also appeared elsewhere. Unfortunately I changed some of the code (line 76) to not set a default value in order to complete the upgrade so it will have skipped through some of the tables that could have had an issue. I will go through the upgrade again later and do a proper check and log the problems and let you know exactly what is happening and whether the patch has worked. The server has been upgraded from 1.5 through to 2.2+ (I think it has been 1.5->1.6->1.7->1.9->2.0->2.2) I tried to run the query in MySQL but for integer values it would not accept '' as a default. If I placed -1 or 0 in then the installer would continue but stopped on the next integer value in the table.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

        TIA and ciao

        Show
        Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
        Hide
        Sam Hemelryk added a comment -

        Thanks Petr, changes look good and have been integrated now

        Show
        Sam Hemelryk added a comment - Thanks Petr, changes look good and have been integrated now
        Hide
        Ankit Agarwal added a comment -

        Hi,
        I tried upgrading from 2.2 to 2.3 using cli and no errors where encountered.
        Thanks

        Show
        Ankit Agarwal added a comment - Hi, I tried upgrading from 2.2 to 2.3 using cli and no errors where encountered. Thanks
        Hide
        Eloy Lafuente (stronk7) added a comment -
        UPDATE tracker_issues
           SET status = 'Closed',
              comment = 'Thanks!'
        WHEN participants = 'Did a gorgeous work'
        

        This landed upstream some hours ago (some - me - developer fell slept in the sofa yesterday before spamming this).

        Show
        Eloy Lafuente (stronk7) added a comment - UPDATE tracker_issues SET status = 'Closed', comment = 'Thanks!' WHEN participants = 'Did a gorgeous work' This landed upstream some hours ago (some - me - developer fell slept in the sofa yesterday before spamming this).
        Hide
        Matthew Cannings added a comment - - edited

        Hi,
        Sorry for the delay. I have just tried an upgrade and it pretty much sailed through now Moodle 2.3dev (Build: 20120504).

        I did hit a problem with the lesson_grades table but could not identify an issue with it and it is probably just an issue with my database.

        error/invalidmysqlnativetype
        More information about this error
        Stack trace: 
        o	line 644 of /lib/dml/mysqli_native_moodle_database.php: dml_exception thrown
        o	line 537 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->mysqltype2moodletype()
        o	line 463 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->get_column_info()
        o	line 522 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_columns()
        o	line 1551 of /lib/dml/moodle_database.php: call to moodle_database->where_clause()
        o	line 60 of /lib/db/upgradelib.php: call to moodle_database->count_records()
        o	line 232 of /lib/db/upgrade.php: call to upgrade_mysql_fix_unsigned_columns()
        o	line 1481 of /lib/upgradelib.php: call to xmldb_main_upgrade()
        o	line 251 of /admin/index.php: call to upgrade_core()
        

        From my backup the table had the following structure

        CREATE TABLE `mdl_lesson_grades` (
          `id` int(10) unsigned NOT NULL auto_increment,
          `lessonid` int(10) unsigned NOT NULL default '0',
          `userid` int(10) unsigned NOT NULL default '0',
          `grade` float unsigned NOT NULL default '0',
          `late` int(3) unsigned NOT NULL default '0',
          `completed` int(10) unsigned NOT NULL default '0',
          PRIMARY KEY  (`id`),
          KEY `lessonid` (`lessonid`),
          KEY `userid` (`userid`)
        ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='Defines lesson_grades';
        

        I manually changed (via phpMyAdmin) the unsigned to not set for each field and ran the upgrade again and it went through.

        Show
        Matthew Cannings added a comment - - edited Hi, Sorry for the delay. I have just tried an upgrade and it pretty much sailed through now Moodle 2.3dev (Build: 20120504). I did hit a problem with the lesson_grades table but could not identify an issue with it and it is probably just an issue with my database. error/invalidmysqlnativetype More information about this error Stack trace: o line 644 of /lib/dml/mysqli_native_moodle_database.php: dml_exception thrown o line 537 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->mysqltype2moodletype() o line 463 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->get_column_info() o line 522 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_columns() o line 1551 of /lib/dml/moodle_database.php: call to moodle_database->where_clause() o line 60 of /lib/db/upgradelib.php: call to moodle_database->count_records() o line 232 of /lib/db/upgrade.php: call to upgrade_mysql_fix_unsigned_columns() o line 1481 of /lib/upgradelib.php: call to xmldb_main_upgrade() o line 251 of /admin/index.php: call to upgrade_core() From my backup the table had the following structure CREATE TABLE `mdl_lesson_grades` ( `id` int(10) unsigned NOT NULL auto_increment, `lessonid` int(10) unsigned NOT NULL default '0', `userid` int(10) unsigned NOT NULL default '0', `grade` float unsigned NOT NULL default '0', `late` int(3) unsigned NOT NULL default '0', `completed` int(10) unsigned NOT NULL default '0', PRIMARY KEY (`id`), KEY `lessonid` (`lessonid`), KEY `userid` (`userid`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='Defines lesson_grades'; I manually changed (via phpMyAdmin) the unsigned to not set for each field and ran the upgrade again and it went through.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: