Manual:revision テーブル

This page is a translated version of the page Manual:Revision table and the translation is 30% complete.
Manual:コンテンツ MediaWiki のデータベース レイアウト revision テーブル
MediaWiki バージョン:
1.5

revision テーブルは、ウィキ内でページに対して行われたそれぞれの編集に関するメタデータを保持します。 単一もしくは複数ページ・スロットへの編集ごとに版レコードが生成されます。そのレコードは、編集をした利用者、編集がなされた日時、リビジョンへのコメントへのリンクような情報を comment テーブル内に保持します。またその他のメタデータも保持します。 The slots that were edited and their corresponding revision are specified in the slots table .

他のウィキにある特定のページの直近の修正のImportは、revision テーブルに2件入力し、1件はインポートした版の日付とウィキ文、もう1件はインポートした日付です。 If a page with the same name already existed, then the wikitext of the latter, which becomes that of the current page, is that of the more recent of the two pages.

revision テーブルは recentchanges テーブルに酷似しています。 revision テーブルはページの履歴および利用者の投稿記録 の列挙に使用されます。 The recentchanges table is used for recent changes , related changes , watchlists , and, in the case of page creation, for the list of new pages .

差分は以下を含みます:

  • The recentchanges table also records logged events such as page moves and deletions
  • Items in the recentchanges table are periodically purged; those in the revision table are retained permanently, unless the page is deleted or the site owner runs the deleteOldRevisions.php maintenance script.
  • as said, import of a page revision not only adds an entry to the revision table with the import date, but also one with the original date.

削除された版は archive テーブルに移動されます。

The revision table and the text table were introduced in MediaWiki 1.5 to supersede the cur table.

フィールド

rev_id

MediaWiki バージョン:
1.5

この項目には各版に対する主キーが書かれています。 page_latest はこの項目への外部キーになっています。 The rev_id numbers have been preserved across deletion/undeletion since the table's inception in MediaWiki 1.5, when rev_id and text_id superseded the old cur_id.

Note that while rev_id almost always increases monotonically for successive revisions of a page, this is not strictly guaranteed as importing from another wiki can cause revisions to be created out of order.

rev_page

MediaWiki バージョン:
1.5

この項目は page への参照情報、つまりどのページに関する版であるのかが書かれています。 この項目に書かれる値は対応するページの page_id に書かれている値と同じです。 無効な値を設定しないでください。無効な値を設定するとページの編集履歴が表示されなくなります。 If page.page_latest links to a revision with an invalid rev_page, this will cause the "The revision #0 of the page named 'Foo' does not exist" error. (similar issue might occur when slots and content are missing for the revision)

rev_text_id

MediaWiki バージョン:
1.5 – 1.34

This is a foreign key to old_id in the text table. (The text table is where the actual bulk text is stored.) It's possible for multiple revisions to use the same text - for instance, revisions where only metadata is altered, or where a rollback is done to a previous version.

(1.31 で廃止予定) If rows in the slots table with slots.slot_revision_id = rev_id exist, this field should be ignored (and may be 0) in favor of the corresponding data from the slots and content tables.

(1.35 で除去) This column was replaced by content.content_address which can be retrieved by getting the slot_content_id for the corresponding revision in the slots table.

rev_comment

MediaWiki バージョン:
1.5 – 1.34

This field holds an editor's edit summary (editor's comment on revision). This text is shown in the history and contributions. (The recentchanges table contains a copy used for recent changes , related changes , watchlists , and, in the case of page creation, for the list of new pages .) It is rendered in a sanitized subset of wiki markup.

(廃止予定) revcomment_comment_id of the revision_comment_temp table and the comment table should be used instead!

(1.35 で除去) This column was replaced by revision.rev_comment_id, which references comment.comment_id.

rev_comment_id

MediaWiki バージョン:
1.35

This is a foreign key to comment_id in the comment table.

In MediaWiki 1.38 and older, if this field contains zero in each record, the comment id must be retrieved from the revision_comment_temp table. See 操作者の移行 .

rev_user

MediaWiki バージョン:
1.5 – 1.34

This is equal to the user_id of the user who made this edit. The value for this field is 0 for anonymous edits, initializations scripts, and for some mass imports.

Note, there are bugs: T112384.

(1.31 で廃止予定) While actor migration is being done, and depending on the configuration setting $wgActorTableSchemaMigrationStage , this field may be empty and the actor performing the edit can be stored in the rev_actor field or the revision_actor_temp table instead.

(1.35 で除去) This column was removed along with revision.rev_user_text. This column is replaced by revision.rev_actor, which references actor.actor_id.

rev_user_text

MediaWiki バージョン:
1.5 – 1.34

This field holds the text of the editor's username , or the IP address of the editor if the revision was done by an unregistered user.

In anonymous revisions imported from UseModWiki or early incarnations of the Phase II software, this field may contain an IP address with the final octet obscured (i.e. \d{1,3}\.\d{1,3}\.\d{1,3}\.xxx such as 24.150.61.xxx; see bug 3631). Some edits imported from UseModWiki may contain a Reverse DNS lookup hostname like ppfree165-153-bz.aknet.it or office.bomis.com.

(1.31 で廃止予定) While actor migration is being done, and depending on the configuration setting $wgActorTableSchemaMigrationStage , this field may be empty and the actor performing the edit can be stored in the rev_actor field or the revision_actor_temp table instead.

(1.35 で除去) This column was removed along with revision.rev_user. This column is replaced by revision.rev_actor, which references actor.actor_id.

rev_actor

MediaWiki バージョン:
1.35

This is a foreign key to actor_id in the actor table. In MediaWiki 1.38 and older versions, if this field contains zero in each record, the actor id must be retrieved from the revision_actor_temp table. 操作者の移行 を参照してください。

rev_timestamp

MediaWiki バージョン:
1.5

Holds the timestamp of the edit. Looks like, for example, 20080326231614 (MW_TS time format). Corresponds to recentchanges.rc_timestamp (and logging.log_timestamp for page creations).

Unlike image.img_timestamp, this value is not fudged to be unique for a given page, so edits happening in quick succession can have the same timestamp.

rev_minor_edit

MediaWiki バージョン:
1.5

ユーザーが'細部の編集'チェックボックスをONにしたかどうかを記録します。 この項目の値が1であればその編集は「細部の編集」であると宣言されたことに、0であればそうでないことになります。 多くの自動編集は細部の編集であるとしてマークされます。

rev_deleted

MediaWiki バージョン:
1.5

This field is reserved for 版指定削除 system. It's a bitfield in which the values are DELETED_TEXT = 1; DELETED_COMMENT = 2; DELETED_USER = 4; and DELETED_RESTRICTED = 8. So, for example, if nothing has been deleted from that revision, then the value is 0; if both the comment and user have been deleted, then the value is 6. DELETED_RESTRICTED indicates suppression; when this flag is set content hidden by the other DELETED_* flags is only visible to suppressors (i.e. oversighters) instead of admins.

rev_len

MediaWiki バージョン:
1.10

この項目にはバイト単位で示したその版での記事の長さが記されています。 履歴ページで使用されます。 Corresponds to rc_new_len .

rev_parent_id

MediaWiki バージョン:
1.10

The rev_id of the previous revision to the page. Corresponds to rc_last_oldid . For edits which are new page creations, rev_parent_id = 0.

使用法

This field is used to add support for a tree structure. This field is e.g. used to calculate the size difference of a certain revision with the previous revision in the page history view. If a parent ID points to a revision that's associated with a different page, MediaWiki will still use that parent revision as a basis of comparison for purposes of calculating size difference. If a revision is deleted from the database, and another revision's parent ID still points to it, then MediaWiki will behave the same as if there were no parent revision; i.e. it will assume the previous size was 0.

Transferred revisions

When revisions are imported from another wiki, the imported revisions' parent ID tree structure from the source wiki is retained (this is implemented by each revision', other than the tail revision, having a ‎<parentid> XML element that is used to populate rev_parent_id), and the destination wiki's revisions' parent IDs are not updated. Likewise, when page histories are merged, the parent IDs of the revisions from the source and destination pages are not updated. populateParentId.php can be used to populate rev_parent_id based on revision timestamps and revision IDs. In the case of an edit conflict, the revision ID of the edit that is saved first (causing the conflict) will be used as the parent ID of the edit that is saved second (after resolving the conflict).

rev_sha1

MediaWiki バージョン:
1.19

この項目は(Wikimedia\base_convert() によって生成される)base-36によるSHA-1テキスト内容ハッシュ値を追加するのに使われます。 バージョン1.32より、その版に関するすべてのslotに渡る content_sha1 のハッシュ値群を入れ子にしたハッシュ値になっています。 版にslotが1つしかない場合、rev_sha1 と content_sha1 の値は同じになります。 入れ子にしたハッシュのアルゴリズムは RevisionSlots::computeSha1() に実装されています。 その概要は以下の通りです:

 rev_sha1 = hash_n;
 hash_n = sha1( hash_n-1, content_sha1_n );
 hash_1 = content_sha1_1;

rev_content_model

MediaWiki バージョン:
1.21 – 1.34

Content model, see CONTENT_MODEL_XXX constants in Defines.php . These IDs will be exposed in the API and XML dumps. Extensions that define their own content model IDs should take care to avoid conflicts. Using the extension name as a prefix is recommended, for example 'myextension-somecontent'. 取りうる値の例: 'wikitext', 'javascript', 'css', 'text', and 'json'

(1.31 で廃止予定) If rows in the slots table with slot_revision_id = rev_id this field should be ignored (and may be NULL) in favor of the corresponding data from the slots and content tables.

(1.35 で除去) This column was replaced by content.content_model, which references content_models.model_id.

rev_content_format

MediaWiki バージョン:
1.21 – 1.34

Content format, see CONTENT_FORMAT_XXX constants in Defines.php . These should be MIME types, and will be exposed in the API and XML dumps. Extensions are free to use the below formats, or define their own. It is recommended to stick with the conventions for MIME types. 取りうる値の例: 'text/x-wiki', 'text/javascript', 'text/css', 'text/plain', 'text/html', 'application/vnd.php.serialized', 'application/json', 'application/xml'

(1.31 で廃止予定) If rows in the slots table with slot_revision_id = rev_id exist, this field should be ignored (and may be NULL).

(1.35 で除去)

This column was removed. The ContentHandler class is able to automatically detect the content format, and replaces this column.

スキーマの要約

MediaWiki バージョン:
1.37
Gerrit change 5954

DESCRIBE revision;

+----------------+---------------------+------+-----+---------+----------------+
| Field          | Type                | Null | Key | Default | Extra          |
+----------------+---------------------+------+-----+---------+----------------+
| rev_id         | int(10) unsigned    | NO   | PRI | NULL    | auto_increment |
| rev_page       | int(10) unsigned    | NO   | MUL | NULL    |                |
| rev_comment_id | bigint(20) unsigned | NO   |     | 0       |                |
| rev_actor      | bigint(20) unsigned | NO   | MUL | 0       |                |
| rev_timestamp  | binary(14)          | NO   | MUL | NULL    |                |
| rev_minor_edit | tinyint(3) unsigned | NO   |     | 0       |                |
| rev_deleted    | tinyint(3) unsigned | NO   |     | 0       |                |
| rev_len        | int(10) unsigned    | YES  |     | NULL    |                |
| rev_parent_id  | int(10) unsigned    | YES  |     | NULL    |                |
| rev_sha1       | varbinary(32)       | NO   |     |         |                |
+----------------+---------------------+------+-----+---------+----------------+
MediaWiki バージョン:
1.35 – 1.36

DESCRIBE revision;

+----------------+---------------------+------+-----+----------------+----------------+
| Field          | Type                | Null | Key | Default        | Extra          |
+----------------+---------------------+------+-----+----------------+----------------+
| rev_id         | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
| rev_page       | int(10) unsigned    | NO   | MUL | NULL           |                |
| rev_comment_id | bigint(20) unsigned | NO   |     | 0              |                |
| rev_actor      | bigint(20) unsigned | NO   | MUL | 0              |                |
| rev_timestamp  | binary(14)          | NO   | MUL |                |                |
| rev_minor_edit | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_deleted    | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_len        | int(10) unsigned    | YES  |     | NULL           |                |
| rev_parent_id  | int(10) unsigned    | YES  |     | NULL           |                |
| rev_sha1       | varbinary(32)       | NO   |     |                |                |
+----------------+---------------------+------+-----+----------------+----------------+
MediaWiki バージョン:
1.31 – 1.34

DESCRIBE revision;

+--------------------+---------------------+------+-----+----------------+----------------+
| Field              | Type                | Null | Key | Default        | Extra          |
+--------------------+---------------------+------+-----+----------------+----------------+
| rev_id             | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
| rev_page           | int(10) unsigned    | NO   | MUL | NULL           |                |
| rev_text_id        | int(10) unsigned    | NO   |     | 0              |                |
| rev_comment        | varbinary(767)      | NO   |     |                |                |
| rev_user           | int(10) unsigned    | NO   | MUL | 0              |                |
| rev_user_text      | varbinary(255)      | NO   | MUL |                |                |
| rev_timestamp      | binary(14)          | NO   | MUL |                |                |
| rev_minor_edit     | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_deleted        | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_len            | int(10) unsigned    | YES  |     | NULL           |                |
| rev_parent_id      | int(10) unsigned    | YES  |     | NULL           |                |
| rev_sha1           | varbinary(32)       | NO   |     |                |                |
| rev_content_model  | varbinary(32)       | YES  |     | NULL           |                |
| rev_content_format | varbinary(64)       | YES  |     | NULL           |                |
+--------------------+---------------------+------+-----+----------------+----------------+
MediaWiki バージョン:
1.30

DESCRIBE revision;

+--------------------+---------------------+------+-----+----------------+----------------+
| Field              | Type                | Null | Key | Default        | Extra          |
+--------------------+---------------------+------+-----+----------------+----------------+
| rev_id             | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
| rev_page           | int(10) unsigned    | NO   | MUL | NULL           |                |
| rev_text_id        | int(10) unsigned    | NO   |     | NULL           |                |
| rev_comment        | varbinary(767)      | NO   |     |                |                |
| rev_user           | int(10) unsigned    | NO   | MUL | 0              |                |
| rev_user_text      | varbinary(255)      | NO   | MUL |                |                |
| rev_timestamp      | binary(14)          | NO   | MUL |                |                |
| rev_minor_edit     | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_deleted        | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_len            | int(10) unsigned    | YES  |     | NULL           |                |
| rev_parent_id      | int(10) unsigned    | YES  |     | NULL           |                |
| rev_sha1           | varbinary(32)       | NO   |     |                |                |
| rev_content_model  | varbinary(32)       | YES  |     | NULL           |                |
| rev_content_format | varbinary(64)       | YES  |     | NULL           |                |
+--------------------+---------------------+------+-----+----------------+----------------+
MediaWiki バージョン:
1.25 – 1.29

DESCRIBE revision;

+--------------------+---------------------+------+-----+----------------+----------------+
| Field              | Type                | Null | Key | Default        | Extra          |
+--------------------+---------------------+------+-----+----------------+----------------+
| rev_id             | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
| rev_page           | int(10) unsigned    | NO   | MUL | NULL           |                |
| rev_text_id        | int(10) unsigned    | NO   |     | NULL           |                |
| rev_comment        | varbinary(767)      | NO   |     | NULL           |                |
| rev_user           | int(10) unsigned    | NO   | MUL | 0              |                |
| rev_user_text      | varbinary(255)      | NO   | MUL |                |                |
| rev_timestamp      | binary(14)          | NO   | MUL |                |                |
| rev_minor_edit     | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_deleted        | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_len            | int(10) unsigned    | YES  |     | NULL           |                |
| rev_parent_id      | int(10) unsigned    | YES  |     | NULL           |                |
| rev_sha1           | varbinary(32)       | NO   |     |                |                |
| rev_content_model  | varbinary(32)       | YES  |     | NULL           |                |
| rev_content_format | varbinary(64)       | YES  |     | NULL           |                |
+--------------------+---------------------+------+-----+----------------+----------------+
MediaWiki バージョン:
1.21 – 1.24

DESCRIBE revision;

+--------------------+---------------------+------+-----+---------+----------------+
| Field              | Type                | Null | Key | Default | Extra          |
+--------------------+---------------------+------+-----+---------+----------------+
| rev_id             | int(10) unsigned    | NO   | PRI | NULL    | AUTO_INCREMENT |
| rev_page           | int(10) unsigned    | NO   | PRI | NULL    |                |
| rev_text_id        | int(10) unsigned    | NO   |     | NULL    |                |
| rev_comment        | tinyblob            | NO   |     | NULL    |                |
| rev_user           | int(10) unsigned    | NO   | MUL | 0       |                |
| rev_user_text      | varchar(255) binary | NO   | MUL | NULL    |                |
| rev_timestamp      | binary(14)          | NO   | MUL | NULL    |                |
| rev_minor_edit     | tinyint(3) unsigned | NO   |     | 0       |                |
| rev_deleted        | tinyint(3) unsigned | NO   |     | 0       |                |
| rev_len            | int(10) unsigned    | YES  |     | NULL    |                |
| rev_parent_id      | int(10) unsigned    | YES  |     | NULL    |                |
| rev_sha1           | varbinary(32)       | NO   |     | NULL    |                |
| rev_content_model  | varbinary(32)       | YES  |     | NULL    |                |
| rev_content_format | varbinary(64)       | YES  |     | NULL    |                |
+--------------------+---------------------+------+-----+---------+----------------+
MediaWiki バージョン:
1.19 – 1.20

DESCRIBE revision;

+----------------+---------------------+------+-----+---------+----------------+
| Field          | Type                | Null | Key | Default | Extra          |
+----------------+---------------------+------+-----+---------+----------------+
| rev_id         | int(10) unsigned    | NO   | PRI | NULL    | AUTO_INCREMENT |
| rev_page       | int(10) unsigned    | NO   | PRI | NULL    |                |
| rev_text_id    | int(10) unsigned    | NO   |     | NULL    |                |
| rev_comment    | tinyblob            | NO   |     | NULL    |                |
| rev_user       | int(10) unsigned    | NO   | MUL | 0       |                |
| rev_user_text  | varchar(255) binary | NO   | MUL | NULL    |                |
| rev_timestamp  | binary(14)          | NO   | MUL | NULL    |                |
| rev_minor_edit | tinyint(3) unsigned | NO   |     | 0       |                |
| rev_deleted    | tinyint(3) unsigned | NO   |     | 0       |                |
| rev_len        | int(10) unsigned    | YES  |     | NULL    |                |
| rev_parent_id  | int(10) unsigned    | YES  |     | NULL    |                |
| rev_sha1       | varbinary(32)       | NO   |     | NULL    |                |
+----------------+---------------------+------+-----+---------+----------------+
MediaWiki バージョン:
1.9 – 1.18

DESCRIBE revision;

+----------------+---------------------+------+-----+---------+----------------+
| Field          | Type                | Null | Key | Default | Extra          |
+----------------+---------------------+------+-----+---------+----------------+
| rev_id         | int(10) unsigned    | NO   | PRI | NULL    | AUTO_INCREMENT |
| rev_page       | int(10) unsigned    | NO   | PRI | NULL    |                |
| rev_text_id    | int(10) unsigned    | NO   |     | NULL    |                |
| rev_comment    | tinyblob            | NO   |     | NULL    |                |
| rev_user       | int(10) unsigned    | NO   | MUL | 0       |                |
| rev_user_text  | varchar(255) binary | NO   | MUL | NULL    |                |
| rev_timestamp  | binary(14)          | NO   | MUL | NULL    |                |
| rev_minor_edit | tinyint(3) unsigned | NO   |     | 0       |                |
| rev_deleted    | tinyint(3) unsigned | NO   |     | 0       |                |
| rev_len        | int(10) unsigned    | YES  |     | NULL    |                |
| rev_parent_id  | int(10) unsigned    | YES  |     | NULL    |                |
+----------------+---------------------+------+-----+---------+----------------+
MediaWiki バージョン:
1.5 – 1.8

DESCRIBE revision;

+----------------+---------------------+------+-----+---------+----------------+
| Field          | Type                | Null | Key | Default | Extra          |
+----------------+---------------------+------+-----+---------+----------------+
| rev_id         | int(8) unsigned     | NO   | PRI | NULL    | AUTO_INCREMENT |
| rev_page       | int(8) unsigned     | NO   | PRI | NULL    |                |
| rev_text_id    | int(8) unsigned     | NO   |     | NULL    |                |
| rev_comment    | tinyblob            | NO   |     | NULL    |                |
| rev_user       | int(5) unsigned     | NO   | MUL | 0       |                |
| rev_user_text  | varchar(255) binary | NO   | MUL | NULL    |                |
| rev_timestamp  | char(14) binary     | NO   | MUL | NULL    |                |
| rev_minor_edit | tinyint(1) unsigned | NO   |     | 0       |                |
| rev_deleted    | tinyint(1) unsigned | NO   |     | 0       |                |
+----------------+---------------------+------+-----+---------+----------------+


インデックス

MediaWiki バージョン:
1.38

SHOW INDEX IN revision;

+----------+------------+--------------------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table    | Non_unique | Key_name                 | Seq_in_index | Column_name   | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+----------+------------+--------------------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| revision |          0 | PRIMARY                  |            1 | rev_id        | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| revision |          1 | rev_timestamp            |            1 | rev_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| revision |          1 | rev_page_timestamp       |            1 | rev_page      | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| revision |          1 | rev_page_timestamp       |            2 | rev_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| revision |          1 | rev_actor_timestamp      |            1 | rev_actor     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| revision |          1 | rev_actor_timestamp      |            2 | rev_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| revision |          1 | rev_actor_timestamp      |            3 | rev_id        | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| revision |          1 | rev_page_actor_timestamp |            1 | rev_page      | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| revision |          1 | rev_page_actor_timestamp |            2 | rev_actor     | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| revision |          1 | rev_page_actor_timestamp |            3 | rev_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
+----------+------------+--------------------------+--------------+---------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

関連項目