X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2Ftables.sql;h=b881d7e0f1ac9eb28f2d26c3c2c6ed86b098a09f;hp=bed80db37c8efd66ed7e57fee7c98f26bf80d147;hb=9106f072f130deef73e6bbcf9a1190ae489269cc;hpb=1649674e83817ab241bd0ac707b8114afc3087e3 diff --git a/maintenance/tables.sql b/maintenance/tables.sql index bed80db37c..b881d7e0f1 100644 --- a/maintenance/tables.sql +++ b/maintenance/tables.sql @@ -213,7 +213,7 @@ CREATE INDEX /*i*/un_user_ip ON /*_*/user_newtalk (user_ip); -- CREATE TABLE /*_*/user_properties ( -- Foreign key to user.user_id - up_user int NOT NULL, + up_user int unsigned NOT NULL, -- Name of the option being saved. This is indexed for bulk lookup. up_property varbinary(255) NOT NULL, @@ -231,7 +231,7 @@ CREATE INDEX /*i*/user_properties_property ON /*_*/user_properties (up_property) -- CREATE TABLE /*_*/bot_passwords ( -- User ID obtained from CentralIdLookup. - bp_user int NOT NULL, + bp_user int unsigned NOT NULL, -- Application identifier bp_app_id varbinary(32) NOT NULL, @@ -611,6 +611,74 @@ CREATE INDEX /*i*/ar_usertext_timestamp ON /*_*/archive (ar_user_text,ar_timesta -- rows, such as change_tag. CREATE INDEX /*i*/ar_revid ON /*_*/archive (ar_rev_id); +-- +-- Slots represent an n:m relation between revisions and content objects. +-- A content object can have a specific "role" in one or more revisions. +-- Each revision can have multiple content objects, each having a different role. +-- +CREATE TABLE /*_*/slots ( + + -- reference to rev_id + slot_revision_id bigint unsigned NOT NULL, + + -- reference to role_id + slot_role_id smallint unsigned NOT NULL, + + -- reference to content_id + slot_content_id bigint unsigned NOT NULL, + + -- whether the content is inherited (1) or new in this revision (0) + slot_inherited tinyint unsigned NOT NULL DEFAULT 0, + + PRIMARY KEY ( slot_revision_id, slot_role_id ) +) /*$wgDBTableOptions*/; + +-- Index for finding revisions that modified a specific slot +CREATE INDEX /*i*/slot_role_inherited ON /*_*/slots (slot_revision_id, slot_role_id, slot_inherited); + +-- +-- The content table represents content objects. It's primary purpose is to provide the necessary +-- meta-data for loading and interpreting a serialized data blob to create a content object. +-- +CREATE TABLE /*_*/content ( + + -- ID of the content object + content_id bigint unsigned PRIMARY KEY AUTO_INCREMENT, + + -- Nominal size of the content object (not necessarily of the serialized blob) + content_size int unsigned NOT NULL, + + -- Nominal hash of the content object (not necessarily of the serialized blob) + content_sha1 varbinary(32) NOT NULL, + + -- reference to model_id + content_model smallint unsigned NOT NULL, + + -- URL-like address of the content blob + content_address varbinary(255) NOT NULL +) /*$wgDBTableOptions*/; + +-- +-- Normalization table for role names +-- +CREATE TABLE /*_*/slot_roles ( + role_id smallint PRIMARY KEY AUTO_INCREMENT, + role_name varbinary(64) NOT NULL +) /*$wgDBTableOptions*/; + +-- Index for looking of the internal ID of for a name +CREATE UNIQUE INDEX /*i*/role_name ON /*_*/slot_roles (role_name); + +-- +-- Normalization table for content model names +-- +CREATE TABLE /*_*/content_models ( + model_id smallint PRIMARY KEY AUTO_INCREMENT, + model_name varbinary(64) NOT NULL +) /*$wgDBTableOptions*/; + +-- Index for looking of the internal ID of for a name +CREATE UNIQUE INDEX /*i*/model_name ON /*_*/content_models (model_name); -- -- Track page-to-page hyperlinks within the wiki. @@ -1640,7 +1708,7 @@ CREATE TABLE /*_*/page_restrictions ( -- Whether or not to cascade the protection down to pages transcluded. pr_cascade tinyint NOT NULL, -- Field for future support of per-user restriction. - pr_user int NULL, + pr_user int unsigned NULL, -- Field for time-limited protection. pr_expiry varbinary(14) NULL ) /*$wgDBTableOptions*/; @@ -1692,9 +1760,9 @@ CREATE TABLE /*_*/change_tag ( -- RCID for the change ct_rc_id int NULL, -- LOGID for the change - ct_log_id int NULL, + ct_log_id int unsigned NULL, -- REVID for the change - ct_rev_id int NULL, + ct_rev_id int unsigned NULL, -- Tag applied ct_tag varchar(255) NOT NULL, -- Parameters for the tag, presently unused @@ -1715,9 +1783,9 @@ CREATE TABLE /*_*/tag_summary ( -- RCID for the change ts_rc_id int NULL, -- LOGID for the change - ts_log_id int NULL, + ts_log_id int unsigned NULL, -- REVID for the change - ts_rev_id int NULL, + ts_rev_id int unsigned NULL, -- Comma-separated list of tags ts_tags blob NOT NULL ) /*$wgDBTableOptions*/;