Error Upgrading from 1.8.1 to 1.9.3

Error Upgrading from 1.8.1 to 1.9.3

by Lucas Wilson -
Number of replies: 7

I receive these errors when trying to upgrade from 1.8.1 to 1.9.3.  Also on the system check before the db upgrade the system is unable to determine the MSSQL version.  I am running MSSQL 2005 on a seperate server.  Moodle runs fine currently but the upgrade keeps failing.  I also tried to manually run the SQL commands on the db server to no avail.

 

Upgrading Moodle database from version 1.8.1+ (2007070603) to 1.9.3 (Build: 20081015) (2007101530)...


(odbc_mssql): SELECT * FROM moodle_mnet_application WHERE id = '-1'  



(odbc_mssql): select c.name,t.name,c.length from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name='MOODLE_MNET_APPLICATION'  



(odbc_mssql): INSERT INTO moodle_mnet_application ( NAME, DISPLAY_NAME, XMLRPC_SERVER_URL, SSO_LAND_URL ) VALUES ( 'moodle', 'Moodle', '/mnet/xmlrpc/server.php', '/auth/mnet/land.php' )  



(odbc_mssql): select SCOPE_IDENTITY()  



(odbc_mssql): INSERT INTO moodle_mnet_application ( NAME, DISPLAY_NAME, XMLRPC_SERVER_URL, SSO_LAND_URL ) VALUES ( 'mahara', 'Mahara', '/api/xmlrpc/server.php', '/auth/xmlrpc/land.php' )  



(odbc_mssql): select SCOPE_IDENTITY()  


Upgrade savepoint: Error during main upgrade to version 2007071400Scroll to next warning
Scroll to previous warningMain Upgrade failed! See lib/db/upgrade.phpScroll to continue button
Average of ratings: -
In reply to Lucas Wilson

Re: Error Upgrading from 1.8.1 to 1.9.3

by Richard Enison -
LW,

I have seen a problem with determination of MSSQL version once before. I wasn't able to definitively solve the problem, but I did make some progress, as recorded in http://moodle.org/mod/forum/discuss.php?d=107965.

RLE
In reply to Richard Enison

Re: Error Upgrading from 1.8.1 to 1.9.3

by Lucas Wilson -

Still no luck.

database mssql docs.gifversion 9.0 is required and you are running Check

I've read the previous post, but it didn't quite fit.  I can't get the version to detect which I believe is the reason I can not upgrade.

In reply to Lucas Wilson

Re: Error Upgrading from 1.8.1 to 1.9.3

by Lucas Wilson -


After playing with the D:\moodle\lib\adodb\adodb.inc.php I found line 366 -370 that controls the MSSQL version.  I was unable to get it to pull the correct version so I inserted some comments (below) and it now detects the version as 9.0 because I manually set it to that.

Replace Function on line 366:

 function _findvers($str)
 {
  /*if (preg_match('/([0-9]+\.([0-9\.])+)/',$str, $arr)) return $arr[1];*/
  /*else*/
  return '9.0';

This fixed the versioning issue but still have these errors:

(odbc_mssql): SELECT * FROM moodle_mnet_application WHERE id = '-1'  



(odbc_mssql): select c.name,t.name,c.length from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name='MOODLE_MNET_APPLICATION'  



(odbc_mssql): INSERT INTO moodle_mnet_application ( NAME, DISPLAY_NAME, XMLRPC_SERVER_URL, SSO_LAND_URL ) VALUES ( 'moodle', 'Moodle', '/mnet/xmlrpc/server.php', '/auth/mnet/land.php' )  



(odbc_mssql): select SCOPE_IDENTITY()  



(odbc_mssql): INSERT INTO moodle_mnet_application ( NAME, DISPLAY_NAME, XMLRPC_SERVER_URL, SSO_LAND_URL ) VALUES ( 'mahara', 'Mahara', '/api/xmlrpc/server.php', '/auth/xmlrpc/land.php' )  



(odbc_mssql): select SCOPE_IDENTITY()  


In reply to Lucas Wilson

Re: Error Upgrading from 1.8.1 to 1.9.3

by Richard Enison -
LW,

You did essentially what I was going to suggest doing, if worse came to worse: temporarily patching the function to force it to see the version as 9. So great. But then you said you got errors, but you don't show any errors, just SQL queries. If there was an error msg. displayed, what did it say? Did the upgrade complete?

RLE
In reply to Richard Enison

Re: Error Upgrading from 1.8.1 to 1.9.3

by Lucas Wilson -

The error is kind of vague.  The continue button is there but I press it and it doesn't go anywhere.  The error is:

Upgrade savepoint: Error during main upgrade to version 2007071400Scroll to next warning
Scroll to previous warningMain Upgrade failed! See lib/db/upgrade.phpScroll to continue button
So I push the Continue button the upgrade does not progress from there.  I'm not sure what to check for in the upgrade.php file.  I manually ran the queries and they succeed but the upgrade still hangs at those queries.
In reply to Lucas Wilson

Re: Error Upgrading from 1.8.1 to 1.9.3

by Jeff Green -

I also am receiving this same set of errors during my attempt to upgrade 1.8 to 1.9.

I modified update.php to dump the results of line 990, "add_key($table, $key);" and obtained this addition error:

CREATE INDEX mdl_mnethost_app_ix ON mdl_mnet_host (applicationid)

S0022: [Microsoft][ODBC SQL Server Driver][SQL Server]Column name 'applicationid' does not exist in the target table or view.

 
 
 
 

Suggestions?

In reply to Lucas Wilson

Re: Error Upgrading from 1.8.1 to 1.9.3

by Jeff Green -
Adding an applicationid column to <prefix>_mnet_host resolved half the issue for me.

For what its worth, here's the SQL to add this column:
ALTER TABLE dbo.<PREFIX>_mnet_host ADD applicationid bigint NOT NULL CONSTRAINT DF_<PREFIX>_mnet_host_applicationid DEFAULT 1

Also, there seems to be an issue with the statement inserting a mahara related row:
$result = $result && insert_record('mnet_application', $application, false);

Sets $result to false, although the INSERT completes successfully. That can't be right.

We don't use Mahara, so I just removed this insert from the upgrade.

Now, we're stuck with a bigger problem - migrating the "Advanced Gradebook" module data into 1.9.