<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yu</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Yu"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Yu"/>
	<updated>2026-04-25T14:04:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=UTF-8_DB&amp;diff=1870</id>
		<title>UTF-8 DB</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=UTF-8_DB&amp;diff=1870"/>
		<updated>2006-01-17T08:29:53Z</updated>

		<summary type="html">&lt;p&gt;Yu: /* Differences between MySQL and PostgreSQL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[UTF-8 migration]] &amp;gt; Databse conversion&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This page is under construction!!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Only some preliminary ideas have been defined. &lt;br /&gt;
&lt;br /&gt;
==Differences between MySQL and PostgreSQL==&lt;br /&gt;
&lt;br /&gt;
Required 4.1! Detect how dabase/tables/columns have been created (charset...)&lt;br /&gt;
How the set_names affect everything (from PHP to MySQL)&lt;br /&gt;
&lt;br /&gt;
A big XML file will map all the required information to make the upgrade for global tables (like course, user etc)&lt;br /&gt;
&lt;br /&gt;
Both modules and blocks will have their own XML file. (like those in /db *.sql)&lt;br /&gt;
e.g.&lt;br /&gt;
NaodW29-pre7b8381b3601a237000000001&lt;br /&gt;
&lt;br /&gt;
The XML file will specify how to locate the course and the user every field belongs to, because translation will be done from course-&amp;gt;lang or user-&amp;gt;lang or site-&amp;gt;lang to utf-8.&lt;br /&gt;
&lt;br /&gt;
Those XML files will be read by one processor. This processor will pre-check that there is XML info available for each table in the DB. The processor will annotate the exact point it is, allowing to resume on crash!&lt;br /&gt;
&lt;br /&gt;
It will be a two-stages process. 1st to convert all the texts, then to convert tables and column encodings (a possible alternative is to duplicate the entire DB with empty tables and then, move all contents to the new one) ?&lt;br /&gt;
&lt;br /&gt;
It&#039;s highly possible that we need to increase DB requirements to MySQL 4.1 (great for the future!). Other users should stick at 1.5.&lt;br /&gt;
&lt;br /&gt;
Collation support inside MySQL is great so we could specify different collations per lang and, dynamicaly sort query results differently.&lt;br /&gt;
&lt;br /&gt;
As postgresql is quite different, an alternate DB migration must be performed for it.&lt;br /&gt;
&lt;br /&gt;
Indexes could break under MySQL (because utf strings are 3x in size). Don&#039;t forget it!&lt;br /&gt;
&lt;br /&gt;
create it able to run under different methods:&lt;br /&gt;
- Under PHP application mode.&lt;br /&gt;
- Processing items in chunks, saving the latest performed table and record to be able of resume in the exact point of break.&lt;br /&gt;
- Able to be skipped for sites in only one encoding (making manual iconv to the database dump and importing again.&lt;br /&gt;
&lt;br /&gt;
two stages, the conversion and the altering schema.&lt;br /&gt;
&lt;br /&gt;
Check that the XML contains information for each $CFG-&amp;gt;prefix table.&lt;br /&gt;
&lt;br /&gt;
Try to convert table and column encoding following the XML too (reading metadata?)&lt;br /&gt;
&lt;br /&gt;
Indexes to long. It&#039;s going to be a problem, sure!!&lt;br /&gt;
&lt;br /&gt;
Modify all the DB creation scripts inside Moodle to specify encoding!!&lt;br /&gt;
&lt;br /&gt;
All the fields in a table at the same time, record by record.&lt;br /&gt;
&lt;br /&gt;
Deactivate the cron (creating a new $CFG-&amp;gt;stopcron variable) and check that the site in under single-user mode (maintenance mode enabled).&lt;br /&gt;
&lt;br /&gt;
==List of tables and fields that need to be converted==&lt;br /&gt;
&lt;br /&gt;
(?) = in progress, not sure yet&lt;br /&gt;
(x) = quite sure =P&lt;br /&gt;
&lt;br /&gt;
Please let me know any table that I don&#039;t need to worry about.&lt;br /&gt;
&lt;br /&gt;
adodb_logsql (?)&lt;br /&gt;
&lt;br /&gt;
assignment (x)&lt;br /&gt;
- name, description&lt;br /&gt;
- course-&amp;gt;lang = select c.lang from course c left join assignment a on c.id = a.course where a.id = a.id&lt;br /&gt;
- user-&amp;gt;lang = - &lt;br /&gt;
&lt;br /&gt;
assignment_submissions (x)&lt;br /&gt;
- comment, data1, data2&lt;br /&gt;
- course-&amp;gt;lang = select c.lang from course c left join assignement a on c.id = a.course left join assignment_submissions as ass on a.id = ass.assignment where ass.id = ass.id&lt;br /&gt;
- user-&amp;gt;lang = select u.lang from user u left join assignment_submissions as ass on u.id = ass.userid where ass.id=ass.id&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
backup_config (?)&lt;br /&gt;
&lt;br /&gt;
backup_courses (x)&lt;br /&gt;
&lt;br /&gt;
backup_files (x)&lt;br /&gt;
&lt;br /&gt;
backup_ids (?)&lt;br /&gt;
&lt;br /&gt;
backup_log (?)&lt;br /&gt;
&lt;br /&gt;
block (x)&lt;br /&gt;
&lt;br /&gt;
block_instance (?)&lt;br /&gt;
-configdata (all empty?)&lt;br /&gt;
&lt;br /&gt;
block_pinned (?)&lt;br /&gt;
-configdata (?)&lt;br /&gt;
&lt;br /&gt;
block_rss_client (?)&lt;br /&gt;
-title, preferredtitle, description(?)&lt;br /&gt;
&lt;br /&gt;
cache_filters (?)&lt;br /&gt;
&lt;br /&gt;
cache_text (?)&lt;br /&gt;
&lt;br /&gt;
chat (x)&lt;br /&gt;
-name, intro&lt;br /&gt;
&lt;br /&gt;
chat_messages (x)&lt;br /&gt;
-message&lt;br /&gt;
&lt;br /&gt;
chat_users (x)&lt;br /&gt;
&lt;br /&gt;
choice (x)&lt;br /&gt;
-name, text&lt;br /&gt;
&lt;br /&gt;
choice_answers (x)&lt;br /&gt;
&lt;br /&gt;
choice_options (x)&lt;br /&gt;
-text&lt;br /&gt;
&lt;br /&gt;
config (x)&lt;br /&gt;
-value see hokudai page 2 in db, chars embedded in tags&lt;br /&gt;
&lt;br /&gt;
config_plugins (?)&lt;br /&gt;
&lt;br /&gt;
course (x)&lt;br /&gt;
password(raw string, see koniv database), fullname, shortname, idnumber, summary, teacher, teachers, student, students&lt;br /&gt;
&lt;br /&gt;
course_allowed_modules (x)&lt;br /&gt;
&lt;br /&gt;
course_categories (x)&lt;br /&gt;
-name, description&lt;br /&gt;
&lt;br /&gt;
course_display (x)&lt;br /&gt;
&lt;br /&gt;
course_meta (x)&lt;br /&gt;
&lt;br /&gt;
course_modules (x)&lt;br /&gt;
&lt;br /&gt;
course_request (?)&lt;br /&gt;
&lt;br /&gt;
course_sections (x)&lt;br /&gt;
-summary&lt;br /&gt;
&lt;br /&gt;
data (x)&lt;br /&gt;
-name, intro&lt;br /&gt;
&lt;br /&gt;
data_comments (x)&lt;br /&gt;
&lt;br /&gt;
data_content (x)&lt;br /&gt;
-conent(composite)&lt;br /&gt;
&lt;br /&gt;
data_fields (x)&lt;br /&gt;
-name, description&lt;br /&gt;
&lt;br /&gt;
data_ratings (x)&lt;br /&gt;
&lt;br /&gt;
data_records (x)&lt;br /&gt;
&lt;br /&gt;
dialogue (x)&lt;br /&gt;
-name, intro&lt;br /&gt;
&lt;br /&gt;
dialogue_conversations (x)&lt;br /&gt;
-subject&lt;br /&gt;
&lt;br /&gt;
dialogue_entries (x)&lt;br /&gt;
-text;&lt;br /&gt;
&lt;br /&gt;
downloads (?)&lt;br /&gt;
&lt;br /&gt;
enrol_authorize (?)&lt;br /&gt;
&lt;br /&gt;
enrol_paypal (?)&lt;br /&gt;
&lt;br /&gt;
event (x)&lt;br /&gt;
-name(composite!), description&lt;br /&gt;
&lt;br /&gt;
exercise (x)&lt;br /&gt;
-name, md5(password?)&lt;br /&gt;
&lt;br /&gt;
exercise_assessments (x)&lt;br /&gt;
-generalcomment, teachercomment&lt;br /&gt;
&lt;br /&gt;
exercise_elements (x)&lt;br /&gt;
-description&lt;br /&gt;
&lt;br /&gt;
exercise_grades (x)&lt;br /&gt;
-feedback&lt;br /&gt;
&lt;br /&gt;
exercise_rubrics (x)&lt;br /&gt;
-description&lt;br /&gt;
&lt;br /&gt;
exercise_submissions (x)&lt;br /&gt;
-title&lt;br /&gt;
&lt;br /&gt;
forum (x)&lt;br /&gt;
-name, intro&lt;br /&gt;
&lt;br /&gt;
forum_discussions (x)&lt;br /&gt;
-name&lt;br /&gt;
&lt;br /&gt;
forum_posts (x)&lt;br /&gt;
-subject, message, attachment (stripeed &amp;amp;#, no need to convert?)&lt;br /&gt;
&lt;br /&gt;
forum_queue (x)&lt;br /&gt;
&lt;br /&gt;
forum_ratings (x)&lt;br /&gt;
&lt;br /&gt;
forum_read (x)&lt;br /&gt;
&lt;br /&gt;
forum_subscriptions (x)&lt;br /&gt;
&lt;br /&gt;
forum_track_prefs (x)&lt;br /&gt;
&lt;br /&gt;
glossary (x)&lt;br /&gt;
-name, intro&lt;br /&gt;
&lt;br /&gt;
glossary_alias (x)&lt;br /&gt;
-alias&lt;br /&gt;
&lt;br /&gt;
glossary_categories (x)&lt;br /&gt;
-name&lt;br /&gt;
&lt;br /&gt;
glossary_comments (x)&lt;br /&gt;
-comment&lt;br /&gt;
&lt;br /&gt;
glossary_entries (x)&lt;br /&gt;
-concept, definition&lt;br /&gt;
&lt;br /&gt;
glossary_entries_categories (x)&lt;br /&gt;
&lt;br /&gt;
glossary_formats (x)&lt;br /&gt;
&lt;br /&gt;
glossary_ratings (x)&lt;br /&gt;
&lt;br /&gt;
grade_category (x)&lt;br /&gt;
-name&lt;br /&gt;
&lt;br /&gt;
grade_exceptions (x)&lt;br /&gt;
&lt;br /&gt;
grade_item (x)&lt;br /&gt;
&lt;br /&gt;
grade_letter (x)&lt;br /&gt;
-letter&lt;br /&gt;
&lt;br /&gt;
grade_preferences (x)&lt;br /&gt;
&lt;br /&gt;
groups&lt;br /&gt;
-name, description, password(stripped), theme(?)&lt;br /&gt;
&lt;br /&gt;
groups_members (x)&lt;br /&gt;
&lt;br /&gt;
hotpot(x)&lt;br /&gt;
-name, summary&lt;br /&gt;
&lt;br /&gt;
hotpot_attempts (x)&lt;br /&gt;
&lt;br /&gt;
hotpot_details (x)&lt;br /&gt;
-details&lt;br /&gt;
&lt;br /&gt;
hotpot_questions (x)&lt;br /&gt;
-name&lt;br /&gt;
&lt;br /&gt;
hotpot_responses (?)&lt;br /&gt;
&lt;br /&gt;
hotpot_strings (x)&lt;br /&gt;
-string&lt;br /&gt;
&lt;br /&gt;
journal (x)&lt;br /&gt;
-name, intro&lt;br /&gt;
&lt;br /&gt;
journal_entries (x)&lt;br /&gt;
-comment, text&lt;br /&gt;
&lt;br /&gt;
label (x)&lt;br /&gt;
name, content (with html)&lt;br /&gt;
&lt;br /&gt;
lams (???)&lt;br /&gt;
&lt;br /&gt;
lesson (x)&lt;br /&gt;
-name, password is (md5(NCR))?&lt;br /&gt;
&lt;br /&gt;
lesson_answers (x)&lt;br /&gt;
-answer, response&lt;br /&gt;
&lt;br /&gt;
lesson_attempts (?)&lt;br /&gt;
-useranswer(?)&lt;br /&gt;
&lt;br /&gt;
lesson_branch (x)&lt;br /&gt;
&lt;br /&gt;
lesson_default (x)&lt;br /&gt;
-password(md5(NCR))?&lt;br /&gt;
&lt;br /&gt;
lesson_grades (x)&lt;br /&gt;
&lt;br /&gt;
lesson_high_scores&lt;br /&gt;
&lt;br /&gt;
lesson_pages (x)&lt;br /&gt;
-title, content&lt;br /&gt;
&lt;br /&gt;
lesson_timer (x)&lt;br /&gt;
&lt;br /&gt;
log (x)&lt;br /&gt;
-info (hokai as well)&lt;br /&gt;
&lt;br /&gt;
log_display (x)&lt;br /&gt;
&lt;br /&gt;
message (x)&lt;br /&gt;
-message (not NCR!)&lt;br /&gt;
&lt;br /&gt;
message_contacts (x)&lt;br /&gt;
&lt;br /&gt;
message_read (x)&lt;br /&gt;
-message (not NCR!)&lt;br /&gt;
&lt;br /&gt;
modules (x)&lt;br /&gt;
&lt;br /&gt;
quiz (x)&lt;br /&gt;
-name, intro, password(md5)?&lt;br /&gt;
&lt;br /&gt;
quiz_answers (x)&lt;br /&gt;
-answer, feedback&lt;br /&gt;
&lt;br /&gt;
quiz_attemptonlast_datasets (x)&lt;br /&gt;
&lt;br /&gt;
quiz_attempts (x)&lt;br /&gt;
&lt;br /&gt;
quiz_calculated (x)&lt;br /&gt;
&lt;br /&gt;
quiz_categories (x)&lt;br /&gt;
-name, info&lt;br /&gt;
&lt;br /&gt;
quiz_dataset_definitions (?)&lt;br /&gt;
&lt;br /&gt;
quiz_dataset_items (?)&lt;br /&gt;
&lt;br /&gt;
quiz_essay (x)&lt;br /&gt;
&lt;br /&gt;
quiz_essay_states (??)&lt;br /&gt;
&lt;br /&gt;
quiz_grades (x)&lt;br /&gt;
&lt;br /&gt;
quiz_match (x)&lt;br /&gt;
&lt;br /&gt;
quiz_match_sub (x)&lt;br /&gt;
-questiontext, answertext&lt;br /&gt;
&lt;br /&gt;
quiz_multianswers (x)&lt;br /&gt;
&lt;br /&gt;
quiz_multichoice (x)&lt;br /&gt;
&lt;br /&gt;
quiz_newest_states (x)&lt;br /&gt;
&lt;br /&gt;
quiz_numerical (x)&lt;br /&gt;
&lt;br /&gt;
quiz_numerical_units (x)&lt;br /&gt;
-unit&lt;br /&gt;
&lt;br /&gt;
quiz_question_datasets (x)&lt;br /&gt;
&lt;br /&gt;
quiz_question_instances (x)&lt;br /&gt;
&lt;br /&gt;
quiz_question_versions (x)&lt;br /&gt;
&lt;br /&gt;
quiz_questions (x)&lt;br /&gt;
-name, questiontext&lt;br /&gt;
&lt;br /&gt;
quiz_randomsamatch (x)&lt;br /&gt;
&lt;br /&gt;
quiz_rqp (?)&lt;br /&gt;
&lt;br /&gt;
quiz_rqp_servers (?)&lt;br /&gt;
&lt;br /&gt;
quiz_rqp_states (?)&lt;br /&gt;
&lt;br /&gt;
quiz_rqp_types (?)&lt;br /&gt;
&lt;br /&gt;
quiz_shortanswer (x)&lt;br /&gt;
&lt;br /&gt;
quiz_states (x)&lt;br /&gt;
answer - composite!&lt;br /&gt;
&lt;br /&gt;
quiz_truefalse (x)&lt;br /&gt;
&lt;br /&gt;
registry (x)&lt;br /&gt;
-sitename, adminname&lt;br /&gt;
&lt;br /&gt;
registry_votes (?)&lt;br /&gt;
&lt;br /&gt;
resource (x)&lt;br /&gt;
-name, summary, alltext&lt;br /&gt;
&lt;br /&gt;
scale (x)&lt;br /&gt;
-name, description, scale&lt;br /&gt;
&lt;br /&gt;
scorm (?)&lt;br /&gt;
-name, summary&lt;br /&gt;
&lt;br /&gt;
scorm_scoes (?)&lt;br /&gt;
&lt;br /&gt;
scorm_scoes_track (?)&lt;br /&gt;
&lt;br /&gt;
sessions (?)&lt;br /&gt;
&lt;br /&gt;
stats_daily (x)&lt;br /&gt;
&lt;br /&gt;
stats_monthly (x)&lt;br /&gt;
&lt;br /&gt;
stats_user_daily (?)&lt;br /&gt;
-stattype&lt;br /&gt;
&lt;br /&gt;
stats_user_monthly (x)&lt;br /&gt;
&lt;br /&gt;
stats_user_weekly (x)&lt;br /&gt;
&lt;br /&gt;
stats_weekly(x)&lt;br /&gt;
&lt;br /&gt;
survey (x)&lt;br /&gt;
-name, intro&lt;br /&gt;
&lt;br /&gt;
survey_analysis (x)&lt;br /&gt;
-notes&lt;br /&gt;
&lt;br /&gt;
survey_answers (?)&lt;br /&gt;
-answerone, answertwo??&lt;br /&gt;
&lt;br /&gt;
survey_questions (?)&lt;br /&gt;
&lt;br /&gt;
timezone(x)&lt;br /&gt;
&lt;br /&gt;
user (x)&lt;br /&gt;
-firstname, lastname, department, institution, address, city, description, secret(?)&lt;br /&gt;
&lt;br /&gt;
user_admins (x)&lt;br /&gt;
&lt;br /&gt;
user_coursecreators (x)&lt;br /&gt;
&lt;br /&gt;
user_preferences (x)&lt;br /&gt;
&lt;br /&gt;
user_students (x)&lt;br /&gt;
&lt;br /&gt;
user_teachers (x)&lt;br /&gt;
&lt;br /&gt;
wiki (x)&lt;br /&gt;
-name, summary, pagename, initialcontent&lt;br /&gt;
&lt;br /&gt;
wiki_entries (x)&lt;br /&gt;
-pagename&lt;br /&gt;
&lt;br /&gt;
wiki_pages (x)&lt;br /&gt;
-pagename, content, author, ref&lt;br /&gt;
&lt;br /&gt;
workshop (x)&lt;br /&gt;
-name, description&lt;br /&gt;
&lt;br /&gt;
workshop_assessments (x)&lt;br /&gt;
-generalcomment, teachercomment&lt;br /&gt;
&lt;br /&gt;
workshop_comments (x)&lt;br /&gt;
-comments&lt;br /&gt;
&lt;br /&gt;
workshop_elements (x)&lt;br /&gt;
-description&lt;br /&gt;
&lt;br /&gt;
workshop_grades (x)&lt;br /&gt;
-feedback&lt;br /&gt;
&lt;br /&gt;
workshop_rubrics (x)&lt;br /&gt;
-description&lt;br /&gt;
&lt;br /&gt;
workshop_stockcomments (x)&lt;br /&gt;
-comments&lt;br /&gt;
&lt;br /&gt;
workshop_submissions (x)&lt;br /&gt;
-title&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:UTF-8|Database]]&lt;/div&gt;</summary>
		<author><name>Yu</name></author>
	</entry>
</feed>