r97441 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97440‎ | r97441 | r97442 >
Date:21:08, 18 September 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Normalise out registrants languages
Modified paths:
  • /trunk/extensions/Wikimania/sql/tables.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikimania/sql/tables.sql
@@ -19,13 +19,6 @@
2020 reg_lname varchar(255) not null,
2121 reg_sex varchar(1) not null,
2222 reg_country varchar(4) not null,
23 - reg_langn varchar(4) not null,
24 - reg_lang1 varchar(4),
25 - reg_lang1_level enum('1','2','3','4'),
26 - reg_lang2 varchar(4),
27 - reg_lang2_level enum('1','2','3','4'),
28 - reg_lang2 varchar(4),
29 - reg_lang2_level enum('1','2','3','4'),
3023 reg_wiki_id varchar(255) not null,
3124 reg_wiki_language varchar(12) not null,
3225 reg_wiki_project varchar(12) not null,
@@ -72,4 +65,13 @@
7366 rh_occupancy int(1) not null,
7467 rh_partner varchar(255),
7568 rh_notes blob
76 -) /**$wgDBTableOptions*/;
 69+) /**$wgDBTableOptions*/;
 70+
 71+-- Table to handle languages a registrant can communicat in
 72+CREATE TABLE /*_*/registration_languages (
 73+ rl_reg_id unsigned int not null,
 74+ rl_lang varchar(4),
 75+ rl_level enum('1','2','3','4'),
 76+
 77+ PRIMARY KEY(rl_reg_id, rl_lang)
 78+)/**$wgDBTableOptions*/;

Follow-up revisions

RevisionCommit summaryAuthorDate
r97448Typofix for r97441demon03:27, 19 September 2011
r105835Fix for r97441: increase length of language code fieldtstarling22:40, 11 December 2011

Comments

#Comment by 😂 (talk | contribs)   00:56, 19 September 2011

This works for lang1, 2 and 3, but not n. I guess we'll need to tweak the enum to list n until we refactor out the enums.

#Comment by Reedy (talk | contribs)   07:46, 19 September 2011

And lang(n)

We could push native language back into the registrants table, as everyone is going to have one. Or we either add a flag in the registration language table to say "this is the users native language", or we "add" a level to the enum to do the same (or number, or whatever else it becomes)

Niklas, per the diff this was just a refactoring :). Perfect time to look at fixing issues like this though

#Comment by Nikerabbit (talk | contribs)   06:29, 19 September 2011

Is 4 the maximum length of the language code? That's not enough for any variant, and it one too much for plain language codes.

#Comment by Tim Starling (talk | contribs)   06:38, 19 September 2011

Note that varchar(4) uses the same amount of space as varchar(255), the only difference is whether it truncates the input. So it's not useful to set a low limit, even if you are developing for a digital watch or a pocket calculator or something.

Status & tagging log