Forums | Mahara Community

Support /
Upgrade from 1.6.2 to 1.9..0 fails


Nicolas Dunand's profile picture
Posts: 11

15 April 2014, 23:51

Hello,

Sorry if this has been answered somewhere else, but I couldn't find any info about this. I just tried upgrading a Mahara site from 1.6.2 to 1.9.0 and it failed with the following error:

PHP Fatal error:  Uncaught exception 'SQLException' with message 'Failed to get a recordset: mysqli error: [1146: Table 'mahara.institution_config' doesn't exist] in EXECUTE("SELECT field, value FROM "institution_config" WHERE "institution" = 'moodletwo' ORDER BY field ")
Command was: SELECT field, value FROM "institution_config" WHERE "institution" = ? ORDER BY field  and values was (moodletwo)' in /var/www/mahara/lib/dml.php:477
Stack trace:
#0 /var/www/mahara/lib/dml.php(433): get_recordset_sql('SELECT field, v...', Array)
#1 /var/www/mahara/lib/dml.php(397): get_recordset_select('institution_con...', '"institution" =...', Array, 'field', 'field, value', '', '')
#2 /var/www/mahara/lib/dml.php(716): get_recordset('institution_con...', 'institution', 'moodletwo', 'field', 'field, value')
#3 /var/www/mahara/lib/institution.php(275): get_records_menu('institution_con...', 'institution', 'moodletwo', 'field', 'field, value')
#4 /var/www/mahara/lib/institution.php( in /var/www/mahara/lib/dml.php on line 477

Is there any recommended upgrade path I might have missed?

Robert Lyon's profile picture
Posts: 749

16 April 2014, 8:08

Hi Nicolas,

The problem you are experiencing is: Table 'mahara.institution_config' doesn't exist
- for some reason this table has not been created.

It should be created around line 2980 in the lib/db/upgrade.php script in version 1.9.

I've done a few tests upgrading Mahara 1.6.2 -> 1.9.0 using mysqli as database and it works fine for me.

Try adding in the missing table manually to mysql, see if gives any erros:

CREATE TABLE `institution_config` (
  `id` bigint(10) NOT NULL AUTO_INCREMENT,
  `institution` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `field` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `value` text COLLATE utf8_unicode_ci,
  PRIMARY KEY (`id`),
  UNIQUE KEY `instconf_insfie_uix` (`institution`,`field`),
  KEY `instconf_ins_ix` (`institution`),
  CONSTRAINT `instconf_ins_fk` FOREIGN KEY (`institution`) REFERENCES `institution` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Otherwise I'm not sure why that table didn't get created during the upgrade process

Cheers

Robert

Nicolas Dunand's profile picture
Posts: 11

16 April 2014, 17:45

Hi Robert,

Thanks a lot for your reply.

Indeed trying to manually add the tables yielded a MySQL errno 150. It seems the `instconf_ins_fk`constraint was the problem, as the exact collation of the referenced table field (institution.name) didn't exactly match institution_config.institution.

After some fiddling I was able to create the missing table, and after that the update went smoothly.

Thanks again!

Oliver Webb's profile picture
Posts: 5

16 April 2014, 20:22

Hi,

This has also happened to me - first from 1.8.1 to 1.9.0 and then from 1.8.2 to 1.9.0.

I haven't tried creating the table manually yet  but will give it a go in a minute.

I also noticed that the config files are different between versions:

1.8.1 - // valid values for dbtype are 'postgres8' and 'mysql5'

1.9.0 -  * valid values for dbtype are 'postgres' and 'mysql'

and wondered if this could be affecting things?

We're using MySQL5.

Many thanks,

Ollie

 

Tobias Zeuch's profile picture
Posts: 111

17 April 2014, 0:09

I don't think that the changes in the config-file have any affect. As far as I see from the code, only the beginning of the setting is evaluated (see lib/dml.php), so mysql5 : 

function is_postgres() {
return (strpos(get_config('dbtype'), 'postgres') === 0);
}

function is_mysql() {
return (strpos(get_config('dbtype'), 'mysql') === 0);
}

anonymous profile picture
Account deleted
Posts: 3

28 April 2014, 23:16

I had a similar problem. I even tried the suggestions above, without success. I then deleted the database and recreated it with UTF8_BIN, reloaded the data from a backup, and was about to roll back to the old version, when I out of curiosity restarted the update. And all of a sudden the update worked, and I have now a version 1.9 running.

Regards,

 

Klaus

Aaron Wells's profile picture
Posts: 896

30 April 2014, 14:08

Yes, for historical reasons in 1.7 and earlier we required the $cfg->dbtype to be "postgres8" or "mysql5", but were actually using the ADODB "postgres" and "mysql" drivers. So in Mahara 1.8 I changed the $cfg->dbtype to "postgres" and "mysql" because those numbers no longer meant anything.

But, for backwards-compatibility, the older "mysql5" and "postgres8" strings are still accepted.

We did change the DB driver used for MySQL in 1.8. In 1.7 and earlier, we were using the deprecated "mysql" PHP library. In 1.8 we silently changed to using the newer "mysqli" library, with code to fall back to the older mysql library if mysqli is not present. (See https://bugs.launchpad.net/mahara/+bug/1187964 ) This shouldn't be causing the sorts of problems you describe, but just in case you could try disabling the mysqli library, via your php.ini file.

Cheers,

Aaron

Muhtajin caem's profile picture
Posts: 4

25 June 2014, 15:48

Hi Nicolas,

 

Can you explain detailed process to create the missing table?

Nicolas Dunand's profile picture
Posts: 11

25 June 2014, 17:13

Hi Muhtajin,

The detailed SQL command to create the missing table is explained in Robert's post, at the top of this thread.

anonymous profile picture
Account deleted
Posts: 3

07 July 2014, 13:09

Hi Robert,

I have a very similar problem using postgres 9.1 on Ubuntu 12.04.

My upgrade is from version 1.4.2 -> 1.9.1

* get_user_institution_language() at /usr/share/mahara/lib/mahara.php:1225
[Mon Jul 07 10:17:41 2014] [error] [client 10.1.5.61] * current_language() at /usr/share/mahara/lib/mahara.php:460
[Mon Jul 07 10:17:41 2014] [error] [client 10.1.5.61] * get_string_location("sqlexceptiontitle", "error", array(size 0)) at /usr/share/mahara/lib/mahara.php:283
[Mon Jul 07 10:17:41 2014] [error] [client 10.1.5.61] * get_string("sqlexceptiontitle", "error") at Unknown:0
[Mon Jul 07 10:17:41 2014] [error] [client 10.1.5.61] * call_user_func_array("get_string", array(size 2)) at /usr/share/mahara/lib/errors.php:493
[Mon Jul 07 10:17:41 2014] [error] [client 10.1.5.61] * MaharaException->get_string("title") at /usr/share/mahara/lib/errors.php:563
[Mon Jul 07 10:17:41 2014] [error] [client 10.1.5.61] * MaharaException->handle_exception() at /usr/share/mahara/lib/errors.php:459
[Mon Jul 07 10:17:41 2014] [error] [client 10.1.5.61] * exception(object(SQLException)) at Unknown:0
[Mon Jul 07 10:17:41 2014] [error] [client 10.1.5.61]
[Mon Jul 07 10:17:41 2014] [error] [client 10.1.5.61] PHP Fatal error: Uncaught exception 'SQLException' with message 'Failed to get a recordset: postgres7 error: [-1: ERROR: relation "institution_config" does not exist\nLINE 1: SELECT field, value FROM "institution_config" WHERE "institu...\n ^] in EXECUTE("SELECT field, value FROM "institution_config" WHERE "institution" = ? ORDER BY field ")\nCommand was: SELECT field, value FROM "institution_config" WHERE "institution" = ? ORDER BY field and values was (mahara)' in /usr/share/mahara/lib/dml.php:477\nStack trace:\n#0 /usr/share/mahara/lib/dml.php(433): get_recordset_sql('SELECT field, v...', Array)\n#1 /usr/share/mahara/lib/dml.php(397): get_recordset_select('institution_con...', '"institution" =...', Array, 'field', 'field, value', '', '')\n#2 /usr/share/mahara/lib/dml.php(716): get_recordset('institution_con...', 'institution', 'mahara', 'field', 'field, value')\n#3 /usr/share/mahara/lib/institution.php(275): get_records_menu('institution_con...', 'institution', 'mahara', 'field', 'field, value')\n# in /usr/share/mahara/lib/dml.php on line 477
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) Failed to get a recordset: postgres7 error: [-1: ERROR: column i.showonlineusers does not exist
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) LINE 1: ...,u.admin,i.displayname,i.theme,i.registerallowed, i.showonli...
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) ^] in EXECUTE("
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) SELECT u.institution,FLOOR(EXTRACT(EPOCH FROM ctime)) AS ctime,FLOOR(EXTRACT(EPOCH FROM u.expiry)) AS membership_expiry,u.studentid,u.staff,u.admin,i.displayname,i.theme,i.registerallowed, i.showonlineusers,i.allowinstitutionpublicviews, i.logo, i.style, i.licensemandatory, i.licensedefault, i.dropdownmenu, i.skins
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) FROM "usr_institution" u INNER JOIN "institution" i ON u.institution = i.name
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) WHERE u.usr = ? ORDER BY i.priority DESC")
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) Command was:
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) SELECT u.institution,FLOOR(EXTRACT(EPOCH FROM ctime)) AS ctime,FLOOR(EXTRACT(EPOCH FROM u.expiry)) AS membership_expiry,u.studentid,u.staff,u.admin,i.displayname,i.theme,i.registerallowed, i.showonlineusers,i.allowinstitutionpublicviews, i.logo, i.style, i.licensemandatory, i.licensedefault, i.dropdownmenu, i.skins
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) FROM "usr_institution" u INNER JOIN "institution" i ON u.institution = i.name
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] [WAR] 78 (lib/errors.php:739) WHERE u.usr = ? ORDER BY i.priority DESC and values was (7)
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] Call stack (most recent first):
[Mon Jul 07 10:20:17 2014] [error] [client 10.1.5.61] * log_message("Failed to get a recordset: postgres7 error: [-1: E...", 8, true, true) at /usr/share/mahara/lib/errors.php:95

 

Can you help?

Regards

Steve

15 results