return $row['version'];
}
+ /**
+ * Query whether a given index exists
+ */
+ function indexExists( $table, $index, $fname = 'DatabaseOracle::indexExists' ) {
+ $table = $this->tableName( $table );
+ $table = strtoupper( $this->removeIdentifierQuotes( $table ) );
+ $index = strtoupper( $index );
+ $owner = strtoupper( $this->mDBname );
+ $SQL = "SELECT 1 FROM all_indexes WHERE owner='$owner' AND index_name='{$table}_{$index}'";
+ $res = $this->doQuery( $SQL );
+ if ( $res ) {
+ $count = $res->numRows();
+ $res->free();
+ } else {
+ $count = 0;
+ }
+ return $count != 0;
+ }
+
/**
* Query whether a given table exists (in the given schema, or the default mw one if not given)
*/
function tableExists( $table ) {
- $table = $this->removeIdentifierQuotes($table);
- $SQL = "SELECT 1 FROM user_tables WHERE table_name='$table'";
+ $table = $this->tableName( $table );
+ $table = strtoupper( $this->removeIdentifierQuotes( $table ) );
+ $owner = strtoupper( $this->mDBname );
+ $SQL = "SELECT 1 FROM all_tables WHERE owner='$owner' AND table_name='$table'";
$res = $this->doQuery( $SQL );
if ( $res ) {
$count = $res->numRows();
} else {
$count = 0;
}
- return $count;
+ return $count != 0;
}
/**
} else {
$this->maintenance = new FakeMaintenance;
}
- $maintenance->setDB( $db );
+ $this->maintenance->setDB( $db );
$this->initOldGlobals();
wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) );
}
protected function getCoreUpdateList() {
return array(
- // 1.16
+ // 1.17
array( 'doNamespaceDefaults' ),
array( 'doFKRenameDeferr' ),
array( 'doFunctions17' ),
array( 'doSchemaUpgrade17' ),
array( 'doInsertPage0' ),
+
+ //1.18
+ array( 'addIndex', 'user', 'i02', 'patch-user_email_index.sql' ),
+ array( 'modifyField', 'user_properties', 'up_property', 'patch-up_property.sql' ),
+
+ // 1.19
+ array( 'addTable', 'config', 'patch-config.sql' ),
+
);
}
--- /dev/null
+define mw_prefix='{$wgDBprefix}';
+
+CREATE TABLE &mw_prefix.config (
+ cf_name VARCHAR2(255) NOT NULL,
+ cf_value blob NOT NULL
+);
+ALTER TABLE &mw_prefix.config ADD CONSTRAINT &mw_prefix.config_pk PRIMARY KEY (cf_name);
+
--- /dev/null
+define mw_prefix='{$wgDBprefix}';
+
+ALTER TABLE &mw_prefix.user_properties MODIFY up_property varchar2(255);
--- /dev/null
+define mw_prefix='{$wgDBprefix}';
+
+CREATE INDEX &mw_prefix.mwuser_i02 ON &mw_prefix.mwuser (user_email, user_name);
+
ALTER TABLE &mw_prefix.mwuser ADD CONSTRAINT &mw_prefix.mwuser_pk PRIMARY KEY (user_id);
CREATE UNIQUE INDEX &mw_prefix.mwuser_u01 ON &mw_prefix.mwuser (user_name);
CREATE INDEX &mw_prefix.mwuser_i01 ON &mw_prefix.mwuser (user_email_token);
+CREATE INDEX &mw_prefix.mwuser_i02 ON &mw_prefix.mwuser (user_email, user_name);
-- Create a dummy user to satisfy fk contraints especially with revisions
INSERT INTO &mw_prefix.mwuser
CREATE TABLE &mw_prefix.user_properties (
up_user NUMBER NOT NULL,
- up_property VARCHAR2(32) NOT NULL,
+ up_property VARCHAR2(255) NOT NULL,
up_value CLOB
);
CREATE UNIQUE INDEX &mw_prefix.user_properties_u01 on &mw_prefix.user_properties (up_user,up_property);
);
CREATE UNIQUE INDEX &mw_prefix.module_deps_u01 ON &mw_prefix.module_deps (md_module, md_skin);
+CREATE TABLE &mw_prefix.config (
+ cf_name VARCHAR2(255) NOT NULL,
+ cf_value blob NOT NULL
+);
+ALTER TABLE &mw_prefix.config ADD CONSTRAINT &mw_prefix.config_pk PRIMARY KEY (cf_name);
+-- leaving index out for now ...
+
+
-- do not prefix this table as it breaks parserTests
CREATE TABLE wiki_field_info_full (
table_name VARCHAR2(35) NOT NULL,