3 * Oracle-specific updater.
10 * Class for handling updates to Oracle databases.
15 class OracleUpdater
extends DatabaseUpdater
{
17 protected function __construct( DatabaseBase
&$db, $shared ) {
18 define( 'MEDIAWIKI_INSTALL', true );
19 parent
::__construct( $db, $shared );
22 protected function getCoreUpdateList() {
25 array( 'doNamespaceDefaults' ),
26 array( 'doFKRenameDeferr' ),
27 array( 'doFunctions17' ),
28 array( 'doSchemaUpgrade17' ),
34 * MySQL uses datatype defaults for NULL inserted into NOT NULL fields
35 * In namespace case that results into insert of 0 which is default namespace
36 * Oracle inserts NULL, so namespace fields should have a default value
38 protected function doNamespaceDefaults() {
39 $this->output( "Altering namespace fields with default value ... " );
40 $meta = $this->db
->fieldInfo( 'page', 'page_namespace' );
41 if ( $meta->defaultValue() != null ) {
42 $this->output( "defaults seem to present on namespace fields\n" );
46 $this->applyPatch( 'patch_namespace_defaults.sql', false );
47 $this->output( "ok\n" );
51 * Uniform FK names + deferrable state
53 protected function doFKRenameDeferr() {
54 $this->output( "Altering foreign keys ... " );
55 $meta = $this->db
->query( 'SELECT COUNT(*) cnt FROM user_constraints WHERE constraint_type = \'R\' AND deferrable = \'DEFERRABLE\'' );
56 $row = $meta->fetchRow();
57 if ( $row && $row['cnt'] > 0 ) {
58 $this->output( "at least one FK is deferrable, considering up to date\n" );
62 $this->applyPatch( 'patch_fk_rename_deferred.sql', false );
63 $this->output( "ok\n" );
67 * Recreate functions to 17 schema layout
69 protected function doFunctions17() {
70 $this->output( "Recreating functions ... " );
71 $this->applyPatch( 'patch_create_17_functions.sql', false );
72 $this->output( "ok\n" );
76 * Schema upgrade 16->17
77 * there are no incremental patches prior to this
79 protected function doSchemaUpgrade17() {
80 $this->output( "Updating schema to 17 ... " );
81 // check if iwlinks table exists which was added in 1.17
82 if ( $this->db
->tableExists( trim( $this->db
->tableName( 'iwlinks' ) ) ) ) {
83 $this->output( "schema seem to be up to date.\n" );
86 $this->applyPatch( 'patch_16_17_schema_changes.sql', false );
87 $this->output( "ok\n" );
91 * Overload: after this action field info table has to be rebuilt
93 public function doUpdates( $purge = true ) {
96 $this->db
->query( 'BEGIN fill_wiki_info; END;' );