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' ),
23 array( 'doInsertPage0' ),
28 * MySQL uses datatype defaults for NULL inserted into NOT NULL fields
29 * In namespace case that results into insert of 0 which is default namespace
30 * Oracle inserts NULL, so namespace fields should have a default value
32 protected function doNamespaceDefaults() {
33 $this->output( "Altering namespace fields with default value ... " );
34 $meta = $this->db
->fieldInfo( 'page', 'page_namespace' );
35 if ( $meta->defaultValue() != null ) {
36 $this->output( "defaults seem to present on namespace fields\n" );
40 $this->applyPatch( 'patch_namespace_defaults.sql', false );
41 $this->output( "ok\n" );
45 * Uniform FK names + deferrable state
47 protected function doFKRenameDeferr() {
48 $this->output( "Altering foreign keys ... " );
49 $meta = $this->db
->query( 'SELECT COUNT(*) cnt FROM user_constraints WHERE constraint_type = \'R\' AND deferrable = \'DEFERRABLE\'' );
50 $row = $meta->fetchRow();
51 if ( $row && $row['cnt'] > 0 ) {
52 $this->output( "at least one FK is deferrable, considering up to date\n" );
56 $this->applyPatch( 'patch_fk_rename_deferred.sql', false );
57 $this->output( "ok\n" );
61 * Recreate functions to 17 schema layout
63 protected function doFunctions17() {
64 $this->output( "Recreating functions ... " );
65 $this->applyPatch( 'patch_create_17_functions.sql', false );
66 $this->output( "ok\n" );
70 * Schema upgrade 16->17
71 * there are no incremental patches prior to this
73 protected function doSchemaUpgrade17() {
74 $this->output( "Updating schema to 17 ... " );
75 // check if iwlinks table exists which was added in 1.17
76 if ( $this->db
->tableExists( $this->db
->tableName( 'iwlinks' ) ) ) {
77 $this->output( "schema seem to be up to date.\n" );
80 $this->applyPatch( 'patch_16_17_schema_changes.sql', false );
81 $this->output( "ok\n" );
85 * Insert page (page_id = 0) to prevent FK constraint violation
87 protected function doInsertPage0() {
88 $this->output( "Inserting page 0 if missing ... " );
91 'page_namespace' => 0,
94 'page_is_redirect' => 0,
97 'page_touched' => $this->db
->timestamp(),
101 $this->db
->insert( 'page', $row, 'OracleUpdater:doInserPage0', array( 'IGNORE' ) );
102 $this->output( "ok\n" );
106 * Overload: after this action field info table has to be rebuilt
108 public function doUpdates( $what = array( 'core', 'extensions', 'purge' ) ) {
109 parent
::doUpdates( $what );
111 $this->db
->query( 'BEGIN fill_wiki_info; END;' );