Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34086 META: Increase robustness of upgrade from 1.9 to 2.2
  3. MDL-25948

Sites using 1.9.x, but originally installed with < 1.7, fail upgrading to 2.0 due to null fields in mdl_user table

XMLWordPrintable

    • PostgreSQL
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • Hide

      1. Install Moodle 1.6 using Postgres.

      I had some issues here with getting Moodle's installer to generate the config.php as it could not connect to the database. I ended up having to create the file myself and specify the port. Eg.

      $CFG->dbtype = 'postgres7'; // mysql or postgres7 (for now)
      $CFG->dbhost = 'localhost'; // eg localhost or db.isp.com
      $CFG->dbname = 'name'; // database name, eg moodle
      $CFG->dbuser = 'user'; // your database username
      $CFG->dbpass = 'pass'; // your database password
      $CFG->dbport = '5432';
      $CFG->prefix = 'mdl_'; // Prefix to use for all table names

      $CFG->dbpersist = false; // Should database connections be reused?

      Remove all references of insertion to logs (eg. INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'add', 'forum', 'name')) from lib/db/postgres7.sql and mod/forum/db/postgres7.sql before the upgrade as they will cause database errors. This is an issue in 1.6/1.7 so not reporting.

      2. Upgrade to 1.9, then to 2.1
      3. Ensure there are no null column errors. eg.

      Debug info: ERROR: column "lastip" contains null values.
      4. Compare the upgraded user table field attributes (default values, length etc) to those of a fresh install to ensure they are the same (note, they will be in the wrong order as the upgrade to 1.9 changes this (another issue?))
      5. Repeat, except for step 2 upgrade to 2.2

      Show
      1. Install Moodle 1.6 using Postgres. I had some issues here with getting Moodle's installer to generate the config.php as it could not connect to the database. I ended up having to create the file myself and specify the port. Eg. $CFG->dbtype = 'postgres7'; // mysql or postgres7 (for now) $CFG->dbhost = 'localhost'; // eg localhost or db.isp.com $CFG->dbname = 'name'; // database name, eg moodle $CFG->dbuser = 'user'; // your database username $CFG->dbpass = 'pass'; // your database password $CFG->dbport = '5432'; $CFG->prefix = 'mdl_'; // Prefix to use for all table names $CFG->dbpersist = false; // Should database connections be reused? Remove all references of insertion to logs (eg. INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('forum', 'add', 'forum', 'name')) from lib/db/postgres7.sql and mod/forum/db/postgres7.sql before the upgrade as they will cause database errors. This is an issue in 1.6/1.7 so not reporting. 2. Upgrade to 1.9, then to 2.1 3. Ensure there are no null column errors. eg. Debug info: ERROR: column "lastip" contains null values. 4. Compare the upgraded user table field attributes (default values, length etc) to those of a fresh install to ensure they are the same (note, they will be in the wrong order as the upgrade to 1.9 changes this (another issue?)) 5. Repeat, except for step 2 upgrade to 2.2

      In sites currently using 1.9.x, that have been originally installed with < 1.7 and then upgraded to 1.9 (even passing through 1.8), the mdl_user table have many NULLable columns without DEFAULTs.

      This will cause upgrading to 2.0.x failing due to db errors.

      -----------------------------------------------------------------
      I attached a simple SQL script that add DEFAULTs and sets NOT NULLs, as a freshly installed 1.9.x (please edit to change table prefix)

            markn Mark Nelson
            nicus Lorenzo Nicora
            Rajesh Taneja Rajesh Taneja
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Votes:
            7 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.