3 * Oracle-specific updater.
10 * Class for handling updates to Oracle databases.
15 class OracleUpdater
extends DatabaseUpdater
{
16 protected function getCoreUpdateList() {
19 array( 'doNamespaceDefaults' ),
20 array( 'doFKRenameDeferr' ),
21 array( 'doFunctions17' ),
22 array( 'doSchemaUpgrade17' ),
27 * MySQL uses datatype defaults for NULL inserted into NOT NULL fields
28 * In namespace case that results into insert of 0 which is default namespace
29 * Oracle inserts NULL, so namespace fields should have a default value
31 protected function doNamespaceDefaults() {
32 $this->output( "Altering namespace fields with default value ... " );
33 $meta = $this->db
->fieldInfo( 'page', 'page_namespace' );
34 if ( $meta->defaultValue() != null ) {
35 $this->output( "defaults seem to present on namespace fields\n" );
39 $this->applyPatch( 'patch_namespace_defaults.sql', false );
40 $this->output( "ok\n" );
44 * Uniform FK names + deferrable state
46 protected function doFKRenameDeferr() {
47 $this->output( "Altering foreign keys ... " );
48 $meta = $this->db
->query( 'SELECT COUNT(*) cnt FROM user_constraints WHERE constraint_type = \'R\' AND deferrable = \'DEFERRABLE\'' );
49 $row = $meta->fetchRow();
50 if ( $row && $row['cnt'] > 0 ) {
51 $this->output( "at least one FK is deferrable, considering up to date\n" );
55 $this->applyPatch( 'patch_fk_rename_deferred.sql', false );
56 $this->output( "ok\n" );
60 * Recreate functions to 17 schema layout
62 protected function doFunctions17() {
63 $this->output( "Recreating functions ... " );
64 $this->applyPatch( 'patch_create_17_functions.sql', false );
65 $this->output( "ok\n" );
69 * Schema upgrade 16->17
70 * there are no incremental patches prior to this
72 protected function doSchemaUpgrade17() {
73 $this->output( "Updating schema to 17 ... " );
74 // check if iwlinks table exists which was added in 1.17
75 if ( $this->db
->tableExists( trim( $this->db
->tableName( 'iwlinks' ) ) ) ) {
76 $this->output( "schema seem to be up to date.\n" );
79 $this->applyPatch( 'patch_16_17_schema_changes.sql', false );
80 $this->output( "ok\n" );
84 * Overload: after this action field info table has to be rebuilt
86 public function doUpdates( $what = array( 'core', 'extensions', 'purge' ) ) {
87 parent
::doUpdates( $what );
89 $this->db
->query( 'BEGIN fill_wiki_info; END;' );