Upgrading to 1.6+: plugin upgrade database errors

Upgrading to 1.6+: plugin upgrade database errors

by Alex Walker -
Number of replies: 4

Below is an example of the errors I'm getting when I try and access the Administration interface and Moodle tries to upgrade itself (the initial upgrade stuff went fine)... this happens for all of calculated, match, multianswer, multichoice, numerical, randomasamatch, rqp, shortanswer and truefalse plugins... and I can't go any further... looks like Moodle's trying to create tables that already exist.

I'm using 1.6+, should I try 1.6 plain or is this an issue either way?


calculated plugin needs upgrading


(mysql): CREATE TABLE mdl_question_calculated ( id int(10) unsigned NOT NULL auto_increment, question int(10) unsigned NOT NULL default '0', answer int(10) unsigned NOT NULL default '0', tolerance varchar(20) NOT NULL default '0.0', tolerancetype int(10) NOT NULL default '1', correctanswerlength int(10) NOT NULL default '2', correctanswerformat int(10) NOT NULL default '2', PRIMARY KEY (id), KEY question (question), KEY answer (answer)) TYPE=MyISAM COMMENT='Options for questions of type calculated'  
1050: Table 'mdl_question_calculated' already exists
         
      
   


Error

Installing calculated FAILED!
Average of ratings: -
In reply to Alex Walker

Re: Upgrading to 1.6+: plugin upgrade database errors

by Alex Walker -

I see other people are having this problem (link) but no solution as yet.  I have tried looking through the source files briefly but can't find where this stage occurs to look at changing the code so instead of creating the tables it alters them... or at least deletes them before recreating, but I hope to no have to do that!

Looks like I might be restoring to 1.5.4 sad

In reply to Alex Walker

Re: Upgrading to 1.6+: plugin upgrade database errors

by Fig Newton -
This fix worked for me...

Re: Upgrade errors
by Tim Hunt - Monday, 17 July 2006, 05:28 PM
The workaround to this problem is:

Take a backup.

Do to upgrade, up until you get to these error messages.

Go into you database, and look at the mdl_config table. You should see 10 rows with names like qtype_xxxxxx_version. You will probably find that all these rows have value 0.

Change the value of all these rows to 2006032200.

Go back to the admin page and resume the upgrade. It should now work.

In reply to Fig Newton

Re: Upgrading to 1.6+: plugin upgrade database errors

by piersante sestini -
Same problem here.
I copied my old 1.5 database, installed a new instance of moodle16 and changed config.php to point to this copied database.

After connecting as the administrator, I get some upgrading activity and get stuck with errors when updating the book module:

================================
(mysql): CREATE TABLE mdl_book ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, course INT(10) UNSIGNED NOT NULL DEFAULT '0', name VARCHAR(255) NOT NULL DEFAULT '', summary TEXT NOT NULL DEFAULT '', numbering TINYINT(4) UNSIGNED NOT NULL DEFAULT '0', disableprinting TINYINT(2) UNSIGNED NOT NULL DEFAULT '0', customtitles TINYINT(2) UNSIGNED NOT NULL DEFAULT '0', timecreated INT(10) UNSIGNED NOT NULL DEFAULT '0', timemodified INT(10) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (id)) COMMENT='Defines book' 1050: Table 'mdl_book' already exists

adodb_mysql._execute(CREATE TABLE mdl_book ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, course INT(10) UNSIGNED NOT NULL DEFAULT '0', name VARCH..., false) % line 853, file: adodb.inc.php
adodb_mysql.execute(CREATE TABLE mdl_book ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, course INT(10) UNSIGNED NOT NULL DEFAULT '0', name VARCH...) % line 49, file: datalib.php
execute_sql(CREATE TABLE mdl_book ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, course INT(10) UNSIGNED NOT NULL DEFAULT '0', name VARCH...) % line 193, file: datalib.php
modify_database(D:\apache2\htdocs\moodle16/mod/book_16/db/mysql.sql) % line 224, file: adminlib.php
upgrade_activity_modules(http://respir.med.unisi.it:8008/moodle16/admin/index.php) % line 229, file: index.php

Error
(mysql): CREATE TABLE mdl_book_chapters ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, bookid INT(10) UNSIGNED NOT NULL DEFAULT '0', pagenum INT(10) UNSIGNED NOT NULL DEFAULT '0', subchapter TINYINT(2) UNSIGNED NOT NULL DEFAULT '0', title VARCHAR(255) NOT NULL DEFAULT '', content LONGTEXT NOT NULL DEFAULT '', hidden TINYINT(2) UNSIGNED NOT NULL DEFAULT '0', timecreated INT(10) UNSIGNED NOT NULL DEFAULT '0', timemodified INT(10) UNSIGNED NOT NULL DEFAULT '0', importsrc VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (id)) COMMENT='Defines book_chapters' 1050: Table 'mdl_book_chapters' already exists

adodb_mysql._execute(CREATE TABLE mdl_book_chapters ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, bookid INT(10) UNSIGNED NOT NULL DEFAULT '0', p..., false) % line 853, file: adodb.inc.php
adodb_mysql.execute(CREATE TABLE mdl_book_chapters ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, bookid INT(10) UNSIGNED NOT NULL DEFAULT '0', p...) % line 49, file: datalib.php
execute_sql(CREATE TABLE mdl_book_chapters ( id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, bookid INT(10) UNSIGNED NOT NULL DEFAULT '0', p...) % line 193, file: datalib.php
modify_database(D:\apache2\htdocs\moodle16/mod/book_16/db/mysql.sql) % line 224, file: adminlib.php
upgrade_activity_modules(http://respir.med.unisi.it:8008/moodle16/admin/index.php) % line 229, file: index.php

Error
(mysql): INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'update', 'book', 'name') 1062: Duplicate entry 'book-update' for key 2

adodb_mysql._execute(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'update', 'book', 'name'), false) % line 853, file: adodb.inc.php
adodb_mysql.execute(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'update', 'book', 'name')) % line 49, file: datalib.php
execute_sql(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'update', 'book', 'name')) % line 193, file: datalib.php
modify_database(D:\apache2\htdocs\moodle16/mod/book_16/db/mysql.sql) % line 224, file: adminlib.php
upgrade_activity_modules(http://respir.med.unisi.it:8008/moodle16/admin/index.php) % line 229, file: index.php

Error
(mysql): INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'view', 'book', 'name') 1062: Duplicate entry 'book-view' for key 2

adodb_mysql._execute(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'view', 'book', 'name'), false) % line 853, file: adodb.inc.php
adodb_mysql.execute(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'view', 'book', 'name')) % line 49, file: datalib.php
execute_sql(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'view', 'book', 'name')) % line 193, file: datalib.php
modify_database(D:\apache2\htdocs\moodle16/mod/book_16/db/mysql.sql) % line 224, file: adminlib.php
upgrade_activity_modules(http://respir.med.unisi.it:8008/moodle16/admin/index.php) % line 229, file: index.php

Error
(mysql): INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'view all', 'book', 'name') 1062: Duplicate entry 'book-view all' for key 2

adodb_mysql._execute(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'view all', 'book', 'name'), false) % line 853, file: adodb.inc.php
adodb_mysql.execute(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'view all', 'book', 'name')) % line 49, file: datalib.php
execute_sql(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'view all', 'book', 'name')) % line 193, file: datalib.php
modify_database(D:\apache2\htdocs\moodle16/mod/book_16/db/mysql.sql) % line 224, file: adminlib.php
upgrade_activity_modules(http://respir.med.unisi.it:8008/moodle16/admin/index.php) % line 229, file: index.php

Error
(mysql): INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'print', 'book', 'name') 1062: Duplicate entry 'book-print' for key 2

adodb_mysql._execute(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'print', 'book', 'name'), false) % line 853, file: adodb.inc.php
adodb_mysql.execute(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'print', 'book', 'name')) % line 49, file: datalib.php
execute_sql(INSERT INTO mdl_log_display (module, action, mtable, field) VALUES ('book', 'print', 'book', 'name')) % line 193, file: datalib.php
modify_database(D:\apache2\htdocs\moodle16/mod/book_16/db/mysql.sql) % line 224, file: adminlib.php
upgrade_activity_modules(http://respir.med.unisi.it:8008/moodle16/admin/index.php) % line 229, file: index.php

Error

book_16 tables could NOT be set up successfully!

=========

sad

Piersante