Index: trunk/extensions/CodeReview/CodeReview.php |
— | — | @@ -165,25 +165,28 @@ |
166 | 166 | # Schema changes |
167 | 167 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'efCodeReviewSchemaUpdates'; |
168 | 168 | |
169 | | -function efCodeReviewSchemaUpdates() { |
170 | | - global $wgDBtype, $wgExtNewFields, /*$wgExtPGNewFields,*/ $wgExtNewIndexes, $wgExtNewTables, $wgExtModifiedFields; |
| 169 | +function efCodeReviewSchemaUpdates( $updater ) { |
171 | 170 | $base = dirname( __FILE__ ); |
172 | | - if ( $wgDBtype == 'mysql' ) { |
173 | | - $wgExtNewTables[] = array( 'code_rev', "$base/codereview.sql" ); // Initial install tables |
174 | | - $wgExtNewFields[] = array( 'code_rev', 'cr_diff', "$base/archives/codereview-cr_diff.sql" ); |
175 | | - $wgExtNewIndexes[] = array( 'code_relations', 'repo_to_from', "$base/archives/code_relations_index.sql" ); |
| 171 | + switch ( $updater->getDB()->getType() ) { |
| 172 | + case 'mysql': |
| 173 | + $updater->addExtensionUpdate( array( 'addTable', 'code_rev', "$base/codereview.sql", true ) ); // Initial install tables |
| 174 | + $updater->addExtensionUpdate( array( 'addField', 'code_rev', 'cr_diff', "$base/archives/codereview-cr_diff.sql", true ) ); |
| 175 | + $updater->addExtensionUpdate( array( 'addIndex', 'code_relations', 'repo_to_from', "$base/archives/code_relations_index.sql", true ) ); |
176 | 176 | |
177 | | - // $wgExtNewFields[] = array( 'code_rev', "$base/archives/codereview-cr_status.sql" ); // FIXME FIXME this is a change to options... don't know how |
| 177 | + // $updater->addExtensionUpdate( array( 'addField', 'code_rev', 'cr_status', "$base/archives/codereview-cr_status.sql", true ) ); // FIXME FIXME this is a change to options... don't know how |
178 | 178 | |
179 | | - if ( !update_row_exists( 'add old to code_rev enum' ) ) { |
180 | | - $wgExtModifiedFields[] = array( 'code_rev', 'cr_status', "$base/archives/codereview-cr_old_status.sql" ); |
| 179 | + if ( !$updater->updateRowExists( 'add old to code_rev enum' ) ) { |
| 180 | + $updater->addExtensionUpdate( array( 'modifyField', 'code_rev', 'cr_status', "$base/archives/codereview-cr_old_status.sql", true ) ); |
181 | 181 | } |
182 | 182 | |
183 | | - $wgExtNewTables[] = array( 'code_bugs', "$base/archives/code_bugs.sql" ); |
184 | | - } elseif ( $wgDBtype == 'sqlite' ) { |
185 | | - $wgExtNewTables[] = array( 'code_rev', "$base/codereview.sql" ); |
186 | | - } elseif ( $wgDBtype == 'postgres' ) { |
| 183 | + $updater->addExtensionUpdate( array( 'addTable', 'code_bugs', "$base/archives/code_bugs.sql", true ) ); |
| 184 | + break; |
| 185 | + case 'sqlite': |
| 186 | + $updater->addExtensionUpdate( array( 'addTable', 'code_rev', "$base/codereview.sql", true ) ); |
| 187 | + break; |
| 188 | + case 'postgres': |
187 | 189 | // TODO |
| 190 | + break; |
188 | 191 | } |
189 | 192 | return true; |
190 | 193 | } |