Index: trunk/phase3/maintenance/archives/patch-updatelog.sql |
— | — | @@ -0,0 +1,4 @@ |
| 2 | +CREATE TABLE /*$wgDBprefix*/updatelog ( |
| 3 | + ul_key varchar(255) NOT NULL, |
| 4 | + PRIMARY KEY (ul_key) |
| 5 | +) /*$wgDBTableOptions*/; |
Property changes on: trunk/phase3/maintenance/archives/patch-updatelog.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 6 | + native |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -132,6 +132,7 @@ |
133 | 133 | // 1.13 |
134 | 134 | array( 'add_field', 'ipblocks', 'ipb_by_text', 'patch-ipb_by_text.sql' ), |
135 | 135 | array( 'add_table', 'page_props', 'patch-page_props.sql' ), |
| 136 | + array( 'add_table', 'updatelog', 'patch-updatelog.sql' ), |
136 | 137 | ); |
137 | 138 | |
138 | 139 | |
— | — | @@ -142,6 +143,20 @@ |
143 | 144 | $wgExtPGNewFields = array(); // table, column attributes; for PostgreSQL |
144 | 145 | $wgExtNewIndexes = array(); // table, index, dir |
145 | 146 | |
| 147 | +# Helper function: check if the given key is present in the updatelog table. |
| 148 | +# Obviously, only use this for updates that occur after the updatelog table was |
| 149 | +# created! |
| 150 | +function update_row_exists( $key ) { |
| 151 | + $dbr = wfGetDB( DB_SLAVE ); |
| 152 | + $row = $dbr->selectRow( |
| 153 | + 'updatelog', |
| 154 | + '1', |
| 155 | + array( 'ul_key' => $key ), |
| 156 | + __FUNCTION__ |
| 157 | + ); |
| 158 | + return (bool)$row; |
| 159 | +} |
| 160 | + |
146 | 161 | function rename_table( $from, $to, $patch ) { |
147 | 162 | global $wgDatabase; |
148 | 163 | if ( $wgDatabase->tableExists( $from ) ) { |
— | — | @@ -1118,7 +1133,6 @@ |
1119 | 1134 | } |
1120 | 1135 | print "ok\n"; |
1121 | 1136 | } |
1122 | | - |
1123 | 1137 | } |
1124 | 1138 | |
1125 | 1139 | function |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -1193,4 +1193,10 @@ |
1194 | 1194 | PRIMARY KEY (pp_page,pp_propname) |
1195 | 1195 | ) /*$wgDBTableOptions*/; |
1196 | 1196 | |
| 1197 | +-- A table to log updates, one text key row per update. |
| 1198 | +CREATE TABLE /*$wgDBprefix*/updatelog ( |
| 1199 | + ul_key varchar(255) NOT NULL, |
| 1200 | + PRIMARY KEY (ul_key) |
| 1201 | +) /*$wgDBTableOptions*/; |
| 1202 | + |
1197 | 1203 | -- vim: sw=2 sts=2 et |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -45,6 +45,7 @@ |
46 | 46 | * (bug 12882) Added a span with class "patrollink" arround "Mark as patrolled" |
47 | 47 | link on diffs |
48 | 48 | * Magic word formatnum can now take raw suffix to undo formatting |
| 49 | +* Add updatelog table to reliably permit updates that don't change the schema |
49 | 50 | |
50 | 51 | === Bug fixes in 1.13 === |
51 | 52 | |