Index: trunk/phase3/maintenance/oracle/archives/patch-config.sql |
— | — | @@ -0,0 +1,8 @@ |
| 2 | +define mw_prefix='{$wgDBprefix}'; |
| 3 | + |
| 4 | +CREATE TABLE &mw_prefix.config ( |
| 5 | + cf_name VARCHAR2(255) NOT NULL, |
| 6 | + cf_value blob NOT NULL |
| 7 | +); |
| 8 | +ALTER TABLE &mw_prefix.config ADD CONSTRAINT &mw_prefix.config_pk PRIMARY KEY (cf_name); |
| 9 | + |
Property changes on: trunk/phase3/maintenance/oracle/archives/patch-config.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 10 | + native |
Index: trunk/phase3/maintenance/oracle/archives/patch-up_property.sql |
— | — | @@ -0,0 +1,3 @@ |
| 2 | +define mw_prefix='{$wgDBprefix}'; |
| 3 | + |
| 4 | +ALTER TABLE &mw_prefix.user_properties MODIFY up_property varchar2(255); |
Property changes on: trunk/phase3/maintenance/oracle/archives/patch-up_property.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 5 | + native |
Index: trunk/phase3/maintenance/oracle/archives/patch-user_email_index.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +define mw_prefix='{$wgDBprefix}'; |
| 3 | + |
| 4 | +CREATE INDEX &mw_prefix.mwuser_i02 ON &mw_prefix.mwuser (user_email, user_name); |
| 5 | + |
Property changes on: trunk/phase3/maintenance/oracle/archives/patch-user_email_index.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6 | + native |
Index: trunk/phase3/maintenance/oracle/tables.sql |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | ALTER TABLE &mw_prefix.mwuser ADD CONSTRAINT &mw_prefix.mwuser_pk PRIMARY KEY (user_id); |
25 | 25 | CREATE UNIQUE INDEX &mw_prefix.mwuser_u01 ON &mw_prefix.mwuser (user_name); |
26 | 26 | CREATE INDEX &mw_prefix.mwuser_i01 ON &mw_prefix.mwuser (user_email_token); |
| 27 | +CREATE INDEX &mw_prefix.mwuser_i02 ON &mw_prefix.mwuser (user_email, user_name); |
27 | 28 | |
28 | 29 | -- Create a dummy user to satisfy fk contraints especially with revisions |
29 | 30 | INSERT INTO &mw_prefix.mwuser |
— | — | @@ -47,7 +48,7 @@ |
48 | 49 | |
49 | 50 | CREATE TABLE &mw_prefix.user_properties ( |
50 | 51 | up_user NUMBER NOT NULL, |
51 | | - up_property VARCHAR2(32) NOT NULL, |
| 52 | + up_property VARCHAR2(255) NOT NULL, |
52 | 53 | up_value CLOB |
53 | 54 | ); |
54 | 55 | CREATE UNIQUE INDEX &mw_prefix.user_properties_u01 on &mw_prefix.user_properties (up_user,up_property); |
— | — | @@ -636,6 +637,14 @@ |
637 | 638 | ); |
638 | 639 | CREATE UNIQUE INDEX &mw_prefix.module_deps_u01 ON &mw_prefix.module_deps (md_module, md_skin); |
639 | 640 | |
| 641 | +CREATE TABLE &mw_prefix.config ( |
| 642 | + cf_name VARCHAR2(255) NOT NULL, |
| 643 | + cf_value blob NOT NULL |
| 644 | +); |
| 645 | +ALTER TABLE &mw_prefix.config ADD CONSTRAINT &mw_prefix.config_pk PRIMARY KEY (cf_name); |
| 646 | +-- leaving index out for now ... |
| 647 | + |
| 648 | + |
640 | 649 | -- do not prefix this table as it breaks parserTests |
641 | 650 | CREATE TABLE wiki_field_info_full ( |
642 | 651 | table_name VARCHAR2(35) NOT NULL, |
Index: trunk/phase3/includes/db/DatabaseOracle.php |
— | — | @@ -894,11 +894,32 @@ |
895 | 895 | } |
896 | 896 | |
897 | 897 | /** |
| 898 | + * Query whether a given index exists |
| 899 | + */ |
| 900 | + function indexExists( $table, $index, $fname = 'DatabaseOracle::indexExists' ) { |
| 901 | + $table = $this->tableName( $table ); |
| 902 | + $table = strtoupper( $this->removeIdentifierQuotes( $table ) ); |
| 903 | + $index = strtoupper( $index ); |
| 904 | + $owner = strtoupper( $this->mDBname ); |
| 905 | + $SQL = "SELECT 1 FROM all_indexes WHERE owner='$owner' AND index_name='{$table}_{$index}'"; |
| 906 | + $res = $this->doQuery( $SQL ); |
| 907 | + if ( $res ) { |
| 908 | + $count = $res->numRows(); |
| 909 | + $res->free(); |
| 910 | + } else { |
| 911 | + $count = 0; |
| 912 | + } |
| 913 | + return $count != 0; |
| 914 | + } |
| 915 | + |
| 916 | + /** |
898 | 917 | * Query whether a given table exists (in the given schema, or the default mw one if not given) |
899 | 918 | */ |
900 | 919 | function tableExists( $table ) { |
901 | | - $table = $this->removeIdentifierQuotes($table); |
902 | | - $SQL = "SELECT 1 FROM user_tables WHERE table_name='$table'"; |
| 920 | + $table = $this->tableName( $table ); |
| 921 | + $table = strtoupper( $this->removeIdentifierQuotes( $table ) ); |
| 922 | + $owner = strtoupper( $this->mDBname ); |
| 923 | + $SQL = "SELECT 1 FROM all_tables WHERE owner='$owner' AND table_name='$table'"; |
903 | 924 | $res = $this->doQuery( $SQL ); |
904 | 925 | if ( $res ) { |
905 | 926 | $count = $res->numRows(); |
— | — | @@ -906,7 +927,7 @@ |
907 | 928 | } else { |
908 | 929 | $count = 0; |
909 | 930 | } |
910 | | - return $count; |
| 931 | + return $count != 0; |
911 | 932 | } |
912 | 933 | |
913 | 934 | /** |
Index: trunk/phase3/includes/installer/DatabaseUpdater.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | } else { |
67 | 67 | $this->maintenance = new FakeMaintenance; |
68 | 68 | } |
69 | | - $maintenance->setDB( $db ); |
| 69 | + $this->maintenance->setDB( $db ); |
70 | 70 | $this->initOldGlobals(); |
71 | 71 | wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) ); |
72 | 72 | } |
Index: trunk/phase3/includes/installer/OracleUpdater.php |
— | — | @@ -23,12 +23,20 @@ |
24 | 24 | |
25 | 25 | protected function getCoreUpdateList() { |
26 | 26 | return array( |
27 | | - // 1.16 |
| 27 | + // 1.17 |
28 | 28 | array( 'doNamespaceDefaults' ), |
29 | 29 | array( 'doFKRenameDeferr' ), |
30 | 30 | array( 'doFunctions17' ), |
31 | 31 | array( 'doSchemaUpgrade17' ), |
32 | 32 | array( 'doInsertPage0' ), |
| 33 | + |
| 34 | + //1.18 |
| 35 | + array( 'addIndex', 'user', 'i02', 'patch-user_email_index.sql' ), |
| 36 | + array( 'modifyField', 'user_properties', 'up_property', 'patch-up_property.sql' ), |
| 37 | + |
| 38 | + // 1.19 |
| 39 | + array( 'addTable', 'config', 'patch-config.sql' ), |
| 40 | + |
33 | 41 | ); |
34 | 42 | } |
35 | 43 | |