saper has uploaded a new change for review. https://gerrit.wikimedia.org/r/99068
Change subject: Restore recentchanges.rc_cur_time (breaks psql) ...................................................................... Restore recentchanges.rc_cur_time (breaks psql) This reverts commit 974562aee92a78be82cf8e1416ef44648bb7dbb7. Removing rc_cur_time from SQL statements causes this error when installing a new wiki on PostgreSQL: Query: INSERT INTO "recentchanges" (rc_timestamp,rc_namespace,rc_title,rc_type,rc_source,rc_minor,rc_cur_id,rc_user,rc_user_text,rc_comment,rc_this_oldid,rc_last_oldid,rc_bot,rc_ip,rc_patrolled,rc_new,rc_old_len,rc_new_len,rc_deleted,rc_logid,rc_log_type,rc_log_action,rc_params,rc_id) VALUES ('2013-12-04 10:54:26 GMT','0','Main_Page','1','mw.new','0','1','0','MediaWiki default',,'1','0','0','127.0.0.1','0','1','0','524','0','0',NULL,,,'1') Function: RecentChange::save Error: 23502 ERROR: null value in column "rc_cur_time" violates not-null constraint This is because rc_cur_time in NOT NULL with no default value on PostgreSQL. Conflicts: includes/changes/RecentChange.php Change-Id: I66034fad8a1cf5485b5daf0421378a28ca58beab Bug-Id: 40667 --- M includes/changes/RecentChange.php M maintenance/rebuildrecentchanges.php M maintenance/tables.sql 3 files changed, 9 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/68/99068/1 diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 0ef71c4..315c47e 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -26,6 +26,7 @@ * mAttribs: * rc_id id of the row in the recentchanges table * rc_timestamp time the entry was made + * rc_cur_time timestamp on the cur row * rc_namespace namespace # * rc_title non-prefixed db key * rc_type is new entry, used to determine whether updating is necessary @@ -158,6 +159,7 @@ return array( 'rc_id', 'rc_timestamp', + 'rc_cur_time', 'rc_user', 'rc_user_text', 'rc_namespace', @@ -258,6 +260,7 @@ # Fixup database timestamps $this->mAttribs['rc_timestamp'] = $dbw->timestamp( $this->mAttribs['rc_timestamp'] ); + $this->mAttribs['rc_cur_time'] = $dbw->timestamp( $this->mAttribs['rc_cur_time'] ); $this->mAttribs['rc_id'] = $dbw->nextSequenceValue( 'recentchanges_rc_id_seq' ); ## If we are using foreign keys, an entry of 0 for the page_id will fail, so use NULL @@ -507,6 +510,7 @@ $rc->mPerformer = $user; $rc->mAttribs = array( 'rc_timestamp' => $timestamp, + 'rc_cur_time' => $timestamp, 'rc_namespace' => $title->getNamespace(), 'rc_title' => $title->getDBkey(), 'rc_type' => RC_EDIT, @@ -567,6 +571,7 @@ $rc->mPerformer = $user; $rc->mAttribs = array( 'rc_timestamp' => $timestamp, + 'rc_cur_time' => $timestamp, 'rc_namespace' => $title->getNamespace(), 'rc_title' => $title->getDBkey(), 'rc_type' => RC_NEW, @@ -679,6 +684,7 @@ $rc->mPerformer = $user; $rc->mAttribs = array( 'rc_timestamp' => $timestamp, + 'rc_cur_time' => $timestamp, 'rc_namespace' => $target->getNamespace(), 'rc_title' => $target->getDBkey(), 'rc_type' => RC_LOG, @@ -735,6 +741,7 @@ wfDeprecated( __METHOD__, '1.22' ); $this->mAttribs = array( 'rc_timestamp' => wfTimestamp( TS_MW, $row->rev_timestamp ), + 'rc_cur_time' => $row->rev_timestamp, 'rc_user' => $row->rev_user, 'rc_user_text' => $row->rev_user_text, 'rc_namespace' => $row->page_namespace, diff --git a/maintenance/rebuildrecentchanges.php b/maintenance/rebuildrecentchanges.php index b9eb809..315176c 100644 --- a/maintenance/rebuildrecentchanges.php +++ b/maintenance/rebuildrecentchanges.php @@ -70,6 +70,7 @@ $dbw->insertSelect( 'recentchanges', array( 'page', 'revision' ), array( 'rc_timestamp' => 'rev_timestamp', + 'rc_cur_time' => 'rev_timestamp', 'rc_user' => 'rev_user', 'rc_user_text' => 'rev_user_text', 'rc_namespace' => 'page_namespace', @@ -184,6 +185,7 @@ $dbw->insertSelect( 'recentchanges', array( 'user', "$logging LEFT JOIN $page ON (log_namespace=page_namespace AND log_title=page_title)" ), array( 'rc_timestamp' => 'log_timestamp', + 'rc_cur_time' => 'log_timestamp', 'rc_user' => 'log_user', 'rc_user_text' => 'user_name', 'rc_namespace' => 'log_namespace', diff --git a/maintenance/tables.sql b/maintenance/tables.sql index 18139b2..d2dbc58 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -1026,8 +1026,6 @@ rc_timestamp varbinary(14) NOT NULL default '', -- This is no longer used - -- Field kept in database for downgrades - -- @todo: add drop patch with 1.24 rc_cur_time varbinary(14) NOT NULL default '', -- As in revision -- To view, visit https://gerrit.wikimedia.org/r/99068 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I66034fad8a1cf5485b5daf0421378a28ca58beab Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: saper <sa...@saper.info> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits