r80012 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80011‎ | r80012 | r80013 >
Date:14:55, 11 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Small db schema change to keep track of which tm a translation originated from
Modified paths:
  • /trunk/extensions/LiveTranslate/LiveTranslate.hooks.php (modified) (history)
  • /trunk/extensions/LiveTranslate/LiveTranslate.sql (modified) (history)
  • /trunk/extensions/LiveTranslate/sql/LT_addTMField.sql (added) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/sql/LT_addTMField.sql
@@ -0,0 +1,2 @@
 2+ALTER TABLE /*_*/live_translate ADD COLUMN memory_id INT(4) unsigned NOT NULL;
 3+UPDATE /*_*/live_translate SET memory_id = 1;
\ No newline at end of file
Property changes on: trunk/extensions/LiveTranslate/sql/LT_addTMField.sql
___________________________________________________________________
Added: svn:eol-style
14 + native
Index: trunk/extensions/LiveTranslate/LiveTranslate.hooks.php
@@ -141,44 +141,61 @@
142142 if ( $wgDBtype == 'mysql' ) {
143143 // Set up the current schema.
144144 if ( $updater === null ) {
145 - global $wgExtNewTables, $wgExtNewIndexes;
 145+ global $wgExtNewTables, $wgExtNewIndexes, $wgExtNewFields;
 146+
146147 $wgExtNewTables[] = array(
147 - 'livetranslate',
 148+ 'live_translate',
148149 $egLiveTranslateIP . '/LiveTranslate.sql',
149150 true
150151 );
151152 $wgExtNewTables[] = array(
152 - 'livetranslatememories',
 153+ 'live_translate_memories',
153154 $egLiveTranslateIP . '/LiveTranslate.sql',
154155 true
155 - );
 156+ );
 157+
156158 $wgExtNewIndexes[] = array(
157159 'live_translate',
158160 'word_translation',
159161 $egLiveTranslateIP . '/sql/LT_IndexWordTranslation.sql',
160162 true
161 - );
 163+ );
 164+
 165+ $wgExtNewFields[] = array(
 166+ 'live_translate',
 167+ 'memory_id',
 168+ $egLiveTranslateIP . '/sql/LT_addTMField.sql'
 169+ );
162170 }
163171 else {
164172 $updater->addExtensionUpdate( array(
165173 'addTable',
166 - 'livetranslate',
 174+ 'live_translate',
167175 $egLiveTranslateIP . '/LiveTranslate.sql',
168176 true
169177 ) );
170178 $updater->addExtensionUpdate( array(
171179 'addTable',
172 - 'livetranslatememories',
 180+ 'live_translate_memories',
173181 $egLiveTranslateIP . '/LiveTranslate.sql',
174182 true
175 - ) );
 183+ ) );
 184+
176185 $updater->addExtensionUpdate( array(
177186 'addIndex',
178187 'live_translate',
179188 'word_translation',
180189 $egLiveTranslateIP . '/sql/LT_IndexWordTranslation.sql',
181190 true
182 - ) );
 191+ ) );
 192+
 193+ $updater->addExtensionUpdate( array(
 194+ 'addField',
 195+ 'live_translate',
 196+ 'memory_id',
 197+ $egLiveTranslateIP . '/sql/LT_addTMField.sql',
 198+ true
 199+ ) );
183200 }
184201 }
185202
Index: trunk/extensions/LiveTranslate/LiveTranslate.sql
@@ -5,12 +5,14 @@
66 word_id INT(8) unsigned NOT NULL,
77 word_language VARCHAR(255) NOT NULL,
88 word_translation VARCHAR(255) NOT NULL,
9 - word_primary INT(1) unsigned NOT NULL
 9+ word_primary INT(1) unsigned NOT NULL,
 10+ memory_id INT(4) unsigned NOT NULL
1011 ) /*$wgDBTableOptions*/;
1112
1213 -- Table to keep track of translation memories for the special words.
1314 CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/live_translate_memories (
1415 memory_id INT(4) unsigned NOT NULL auto_increment PRIMARY KEY,
1516 memory_type INT(2) unsigned NOT NULL,
16 - memory_location VARCHAR(255) NOT NULL
 17+ memory_location VARCHAR(255) NOT NULL,
 18+ memory_local INT(1) unsigned NOT NULL
1719 ) /*$wgDBTableOptions*/;
\ No newline at end of file

Status & tagging log