Serious Database help needed

Serious Database help needed

by Russell Myers -
Number of replies: 13
I am running 1.7.1 on an OS X 10.4 server. It works fine, but I HAVE to upgrade t 1.9. In doing so, everything about the database ad upgrade goes great except for the quiz module. I keep getting errors. I have tried to "milk" the upgrade, but I just can't get it to go through.

I tried to do this before and I gave up: http://moodle.org/mod/forum/discuss.php?d=63231#p285289

I have a GUI called navicat for mysql and I can run it from the command line. I have no idea how to get more information to show the problem. I have the test server running at: http://rusty.isa-geek.org/moodleutf/

Please help me, and for my feeble brain, please be specific. Thanks

Average of ratings: -
In reply to Russell Myers

Re: Serious Database help needed

by Russell Myers -
Bump, can anyone help???
In reply to Russell Myers

Re: Serious Database help needed

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
Hi Russel,

> I keep getting errors.

Could you cut and paste some of the errors messages. The first one is usually the most revealing.
In reply to Gordon Bateson

Re: Serious Database help needed

by Russell Myers -
Thanks;

This script generated 3 warnings - Scroll to the first warning

quiz module needs upgrading


(mysql): ALTER TABLE mdl_question ADD commentarytext TEXT DEFAULT '' not null AFTER `image`
1060: Duplicate column name 'commentarytext'
 
 
 
 
 
Scroll to previous warningUpgrade function quiz_upgrade did not complete successfully.Scroll to next warning
Scroll to previous warningUpgrading quiz from 2006060700 to 2007101509 FAILED!Scroll to continue button

In reply to Russell Myers

Re: Serious Database help needed

by Russell Myers -
This is what I tried:

in mdl_question, delete commentary text

after that the next error is for mdl_quiz
in mdl_quiz_feedback, delete table

after that is mdl_question
mdl_question_sessions, delete manualcomment

Then I have to change some table encoding
latin1 to utf8 for:
mdl_context
mdl_capabilities
mdl_log
mdl_questionnaire*

These were my notes from a while ago, so I'm not sure why I have an astrix next to questionnaire. I can try to run through these changes again, but it kept looping me back through them.

Help...
In reply to Russell Myers

Re: Serious Database help needed

by Richard Enison -
RM,

Here is what I would do:
  1. Hopefully you have a b/u (always, always, ALWAYS back up before making changes!) of your Moodle 1.7.1. Restore it.
  2. Go to the admin page and run the db migration tool which should be at the top of the page.
  3. if it isn't there because it thinks the db is already utf8 (from your posts I surmise it is not), edit config.php in the main Moodle directory so that it says

    $CFG->unicodedb = false;

  4. Now you should be able to do step # 2.
  5. Upgrade to 1.8+.
  6. Upgrade to 1.9+
Skipping step # 5 (skipping major versions) can sometimes result in the kind of problem you seem to be having.

RLE
Average of ratings: Useful (1)
In reply to Richard Enison

Re: Serious Database help needed

by Russell Myers -
Thanks, I have restored the 1.7.1 database and site and now my admin account does not allow me to go to the admin section of the site...

I am searching the forums for the solution, but it's so bloody difficult to do it.

Edit:

I have checked my role and I am supposidly an legacy:admin, so I'm not sure what happened, but I'm going to restore the database again and see what happens.
In reply to Russell Myers

Re: Serious Database help needed

by Russell Myers -
I got the admin working and back into the database and started the upgrade, it started at 10pm and I let is sit. as it started, there were errors:

unknown language detected: en_us_utf8

unknown language detected: fi_utf8

unknown language detected: sv_utf8

these are repeated hundreds of times, but mostly just the en_us_utf8.

Thanks for all your help, I'll be posting with the updates tomorrow.


In reply to Russell Myers

Re: Serious Database help needed

by Russell Myers -
I tried to let the migration run overnight and it stoped when I closed the lid of my laptop at 2 in the morning when my 8 month old wouldn't sleep. So I tried to restart it on the server and it locked me out of the admin. It said that the site was in maintenance mode, but only at the admin page, the rest of the site was available. BUt then I lost admin again, so I have restored the backup and started the migration again hoping it completes.

I noticed that some of the tables were latin1_swedish_ci, but most were utf8_general_ci. I have no idea what that means, ANyone know?
In reply to Russell Myers

Re: Serious Database help needed

by John Macklin -
UTF-8 (collation) is a multi-byte character encoding scheme!!! UTF-8 supports characters of almost any language (latin, greek, hebrew, arabic, chinese, etc). Simply it is useful if you want to display languages with different
alphabets. Latin-1 (collation) supports English and Western European languages.


If you look at the file structure in moodle, you will see a folder called lang.
Inside will be the languages you use on your site. You most likely will want to
use en_us_utf8 language pack. All blocks are installed in the moodle/block folder and their language files go in the lang/en_us_utf8 and lang/en_us_utf8/help folders.


In reply to Russell Myers

Re: Serious Database help needed

by Richard Enison -
RM,

To elaborate on JM's responses:

Utf8 is as he describes, but more to the point, it was
  1. not allowed by Moodle before version 1.6
  2. optional in 1.6 and 1.7
  3. required in 1.8 and higher.
That is, the Moodle db must use Utf8 exclusively. All text fields (columns) in all tables must use character set utf8. The default character set of each table and the db itself must be utf8. The fact that some of your tables are not utf8 is problematic.

For these reasons, a db migration (conversion to utf8) was supplied with Moodle 1.6 and 1.7 only (the link to it was at the top of the admin page). By the time you get to 1.8 it is too late, because it is required by then. The migration tool is no longer available. One of two things is supposed to happen:
  1. You got to 1.8 by upgrading from a lower version. Then you were expected to run the db migration tool at 1.6 or 1.7 before upgrading to 1.8. You should have gotten errors if you upgraded with a non-Unicode (utf8) db.
  2. You created a new Moodle installation at 1.8. Then all you had to do was create an empty db with a default character set of utf8. The rest should be taken care of automatically as Moodle creates the tables for you.
I see from your opening post that you were originally running Moodle 1.7.1, so that would have been the time to use the db migration tool. You said you had a b/u and could restore to 1.7.1 (again!) so you will be able to get another chance to do that.

Some of JM's comments might relate to the error msgs. you reported earlier (unknown language detected). I tried but failed, when I saw that post, to find out exactly where that msg. comes from, for I have never seen it before. It might be of some small interest to see which language packs you have installed. There are two places they could be: in the lang subfolder of your main Moodle folder, as JM mentioned, and in a lang subfolder of your Moodle data folder.

RLE
Average of ratings: Useful (1)
In reply to Richard Enison

Re: Serious Database help needed

by Russell Myers -
OK! So here is whats been going on,

I've had some help, Scott our intern.

We've gotten the moodle test database and site set up. We've downgraded to 1.7. We've run the migration script, we've upgraded to 1.9.1. During the upgrade I got 4 errors. They all had to do with the quiz module. I could remove the quiz module and the site would function fine, as soon I as re-added the quiz mod, it started to bark at me again.

So, this is what I did, during the upgrade, I did 4 things to the database to fix the quiz issue.

1. Delete the Commentarytext field from mdl_question table.
2. Delete quiz_feedback table.
3. Add comment in the question_sessions table.
4. Change "itemnumber" to "number" in the mdl_question_database_items table.

After that, the upgrade went through ok and the site was up and running with full capabilities in 1.9.1!

So thanks all for the help, My issues are solved for the time being!
In reply to Russell Myers

Re: Serious Database help needed

by shivam gupta -
Hi Russell,

I am at humanities at ucla...and we are working on the same migration effort that you have mentioned in your above statement. I have so far run the migration script on moodle 1.8 and the content migration works fine but the issue is with the quiz migration.

It gets migrated but partly also there are issues with admin, instructor and user logins....my concern is i have not implemented ur solution yet...so in your case now both the quiz and content are working fine?

regards,
shivam