Please can someone explain UTF8 migration to me?

Please can someone explain UTF8 migration to me?

Tim Hunt發表於
Number of replies: 6
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
I thought that UTF8 migration was just something we had to worry about when people upgraded from Moodle 1.5 to 1.6.

However, last night I checked in a change to the quiz module in 1.7dev that created a new table, and this morning I find that someone has kindly checked in some corresponging changes to the migrate2utf8.php and migrate2utf8.xml file.

Why is this necessary? If it is, I'll be sure to do this myself in all future database changes.

It seems to have taken 48 lines of PHP and 9 lines of XML just to say 'This table has one text column that needs to be converted'. If that is typical, doing this for all future database changes is going to be a complete pain in the neck.
評比平均分數: -
In reply to Tim Hunt

Re: Please can someone explain UTF8 migration to me?

Martin Dougiamas發表於
Core developers的相片 Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片
a) We have to cope with 1.5 -> 1.7 upgrades

b) We need to detail exactly how to convert that text field, because it could be in any language and the language is not stored with the text.

I think we'll not maintain these further after 1.7 or something though. We'll just have to change the upgrade to refuse to run PRE1.6 -> POST 1.7, and require a two step upgrade (once to 1.7, and once to the next version).
In reply to Martin Dougiamas

Re: Please can someone explain UTF8 migration to me?

Tim Hunt發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
OK, but if a new table is added in 1.7, how can it end up containing non-UTF-8 data?

If that table can never contain old data, why do we need to write conversion code for it?
In reply to Tim Hunt

Re: Please can someone explain UTF8 migration to me?

Martin Dougiamas發表於
Core developers的相片 Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Plugin developers的相片 Testers的相片
The tables are added before the UTF migration, so they'll be added under the old database character set (and need to be converted).

You're right the conversion of *data* is probably not necessary (though I have a nagging feeling there was some case someone mentioned, ask Eloy on MDL-6326) but I guess it's just there for completeness.
In reply to Martin Dougiamas

Re: Please can someone explain UTF8 migration to me?

Tim Hunt發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Right, well the main reason for me asking is that some of my other changes have added text-type database columns to some existing tables.

Do I need to remember which columns they were, and make sure they are converted too?
In reply to Tim Hunt

Re: Please can someone explain UTF8 migration to me?

Eloy Lafuente (stronk7)發表於
Core developers的相片 Documentation writers的相片 Moodle HQ的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片 Testers的相片
Hi Tim,

yep, all the textual columns created under Moodle 1.7 must have their correspondence in the UTF-8 migration stuff. Absolutely! Required changes can go from simply editing the migration xml files to add the new field (if field contents are simply tokens) to a more complete solution (like the one implemented today by Yu with the feedback text).

All those migration to UTF-8 stuff will be out from HEAD once MOODLE_17_STABLE was released and future Moodle releases (after 1.7) will require Unicode DBs to work (I've filled Bug 6332 about that some minutes ago).

Ciao 微笑
In reply to Eloy Lafuente (stronk7)

Re: Please can someone explain UTF8 migration to me?

Tim Hunt發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Thanks for the explanation. I am really glad this stuff will not be hanging around for long. I'll file a bug listing the columns I have added.