Manual:comment table

From MediaWiki.org
Jump to navigation Jump to search
Manual:Contents MediaWiki database layout comment table


MediaWiki version: 1.30

Edits, blocks, and other actions typically have a textual comment describing the action. They are stored in a separate table to reduce the size of the main tables, and to allow for de-duplication.

De-duplication is currently best-effort to avoid locking on inserts that would be required for strict de-duplication. There may be multiple rows with the same comment_text and comment_data.

This table was introduced in Gerrit change 357892.

Fields[edit]

comment_id[edit]

Unique ID to identify each comment.

comment_hash[edit]

Hash of comment_text and comment_data, for de-duplication.

comment_text[edit]

Text comment summarizing the change, e.g. an editor's edit summary. This text is shown in the history and contributions. It is also 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 by Linker::formatComment(). Size limits are enforced at the application level, and should take care to crop UTF-8 strings appropriately.

comment_data[edit]

JSON data, intended for localizing auto-generated comments. This holds structured data that is intended to be used to provide localized versions of automatically-generated comments. When not empty, comment_text should be the generated comment localized using the wiki's content language.

Definition[edit]

--
-- Edits, blocks, and other actions typically have a textual comment describing
-- the action. They are stored here to reduce the size of the main tables, and
-- to allow for deduplication.
--
-- Deduplication is currently best-effort to avoid locking on inserts that
-- would be required for strict deduplication. There MAY be multiple rows with
-- the same comment_text and comment_data.
--
CREATE TABLE /*_*/comment (
  -- Unique ID to identify each comment
  comment_id bigint unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,

  -- Hash of comment_text and comment_data, for deduplication
  comment_hash INT NOT NULL,

  -- Text comment summarizing the change.
  -- This text is shown in the history and other changes lists,
  -- rendered in a subset of wiki markup by Linker::formatComment()
  -- Size limits are enforced at the application level, and should
  -- take care to crop UTF-8 strings appropriately.
  comment_text BLOB NOT NULL,

  -- JSON data, intended for localizing auto-generated comments.
  -- This holds structured data that is intended to be used to provide
  -- localized versions of automatically-generated comments. When not empty,
  -- comment_text should be the generated comment localized using the wiki's
  -- content language.
  comment_data BLOB
) /*$wgDBTableOptions*/;
-- Index used for deduplication.
CREATE INDEX /*i*/comment_hash ON comment (comment_hash);