wiki.techinc.nl/maintenance/sqlite/tables-generated.sql
Amir Sarabadani 61eaa48f3c Migrate imagelinks table to abstract schema
In order to migrate MySQL and Sqlite to abstract schema changed the
il_to data type from varchar binary to varbinary. This wouldn't
affect production.

For migrating Postgres:
 - Dropping foreign key on il_from
 - Setting default of empty string for il_to
 - Completely rewriting indexes to make it synced with MySQL

Bug: T164898
Bug: T230428
Change-Id: I59f0d0a56d938a168bf1c7de2a1be47f15d1add1
2020-08-22 22:59:00 +02:00

205 lines
5.4 KiB
SQL

-- This file is automatically generated using maintenance/generateSchemaSql.php.
-- Source: maintenance/tables.json
-- Do not modify this file directly.
-- See https://www.mediawiki.org/wiki/Manual:Schema_changes
CREATE TABLE /*_*/site_identifiers (
si_type BLOB NOT NULL,
si_key BLOB NOT NULL,
si_site INTEGER UNSIGNED NOT NULL,
PRIMARY KEY(si_type, si_key)
);
CREATE INDEX site_ids_site ON /*_*/site_identifiers (si_site);
CREATE INDEX site_ids_key ON /*_*/site_identifiers (si_key);
CREATE TABLE /*_*/updatelog (
ul_key VARCHAR(255) NOT NULL,
ul_value BLOB DEFAULT NULL,
PRIMARY KEY(ul_key)
);
CREATE TABLE /*_*/actor (
actor_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
actor_user INTEGER UNSIGNED DEFAULT NULL,
actor_name BLOB NOT NULL
);
CREATE UNIQUE INDEX actor_user ON /*_*/actor (actor_user);
CREATE UNIQUE INDEX actor_name ON /*_*/actor (actor_name);
CREATE TABLE /*_*/user_former_groups (
ufg_user INTEGER UNSIGNED DEFAULT 0 NOT NULL,
ufg_group BLOB DEFAULT '' NOT NULL,
PRIMARY KEY(ufg_user, ufg_group)
);
CREATE TABLE /*_*/bot_passwords (
bp_user INTEGER UNSIGNED NOT NULL,
bp_app_id BLOB NOT NULL,
bp_password BLOB NOT NULL,
bp_token BLOB DEFAULT '' NOT NULL,
bp_restrictions BLOB NOT NULL,
bp_grants BLOB NOT NULL,
PRIMARY KEY(bp_user, bp_app_id)
);
CREATE TABLE /*_*/comment (
comment_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
comment_hash INTEGER NOT NULL, comment_text BLOB NOT NULL,
comment_data BLOB DEFAULT NULL
);
CREATE INDEX comment_hash ON /*_*/comment (comment_hash);
CREATE TABLE /*_*/slots (
slot_revision_id BIGINT UNSIGNED NOT NULL,
slot_role_id SMALLINT UNSIGNED NOT NULL,
slot_content_id BIGINT UNSIGNED NOT NULL,
slot_origin BIGINT UNSIGNED NOT NULL,
PRIMARY KEY(slot_revision_id, slot_role_id)
);
CREATE INDEX slot_revision_origin_role ON /*_*/slots (
slot_revision_id, slot_origin, slot_role_id
);
CREATE TABLE /*_*/site_stats (
ss_row_id INTEGER UNSIGNED NOT NULL,
ss_total_edits BIGINT UNSIGNED DEFAULT NULL,
ss_good_articles BIGINT UNSIGNED DEFAULT NULL,
ss_total_pages BIGINT UNSIGNED DEFAULT NULL,
ss_users BIGINT UNSIGNED DEFAULT NULL,
ss_active_users BIGINT UNSIGNED DEFAULT NULL,
ss_images BIGINT UNSIGNED DEFAULT NULL,
PRIMARY KEY(ss_row_id)
);
CREATE TABLE /*_*/user_properties (
up_user INTEGER UNSIGNED NOT NULL,
up_property BLOB NOT NULL,
up_value BLOB DEFAULT NULL,
PRIMARY KEY(up_user, up_property)
);
CREATE INDEX user_properties_property ON /*_*/user_properties (up_property);
CREATE TABLE /*_*/log_search (
ls_field BLOB NOT NULL,
ls_value VARCHAR(255) NOT NULL,
ls_log_id INTEGER UNSIGNED DEFAULT 0 NOT NULL,
PRIMARY KEY(ls_field, ls_value, ls_log_id)
);
CREATE INDEX ls_log_id ON /*_*/log_search (ls_log_id);
CREATE TABLE /*_*/change_tag (
ct_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
ct_rc_id INTEGER UNSIGNED DEFAULT NULL,
ct_log_id INTEGER UNSIGNED DEFAULT NULL,
ct_rev_id INTEGER UNSIGNED DEFAULT NULL,
ct_params BLOB DEFAULT NULL, ct_tag_id INTEGER UNSIGNED NOT NULL
);
CREATE UNIQUE INDEX change_tag_rc_tag_id ON /*_*/change_tag (ct_rc_id, ct_tag_id);
CREATE UNIQUE INDEX change_tag_log_tag_id ON /*_*/change_tag (ct_log_id, ct_tag_id);
CREATE UNIQUE INDEX change_tag_rev_tag_id ON /*_*/change_tag (ct_rev_id, ct_tag_id);
CREATE INDEX change_tag_tag_id_id ON /*_*/change_tag (
ct_tag_id, ct_rc_id, ct_rev_id, ct_log_id
);
CREATE TABLE /*_*/content (
content_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
content_size INTEGER UNSIGNED NOT NULL,
content_sha1 BLOB NOT NULL, content_model SMALLINT UNSIGNED NOT NULL,
content_address BLOB NOT NULL
);
CREATE TABLE /*_*/l10n_cache (
lc_lang BLOB NOT NULL,
lc_key VARCHAR(255) NOT NULL,
lc_value BLOB NOT NULL,
PRIMARY KEY(lc_lang, lc_key)
);
CREATE TABLE /*_*/module_deps (
md_module BLOB NOT NULL,
md_skin BLOB NOT NULL,
md_deps BLOB NOT NULL,
PRIMARY KEY(md_module, md_skin)
);
CREATE TABLE /*_*/redirect (
rd_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
rd_namespace INTEGER DEFAULT 0 NOT NULL,
rd_title BLOB DEFAULT '' NOT NULL,
rd_interwiki VARCHAR(32) DEFAULT NULL,
rd_fragment BLOB DEFAULT NULL,
PRIMARY KEY(rd_from)
);
CREATE INDEX rd_ns_title ON /*_*/redirect (rd_namespace, rd_title, rd_from);
CREATE TABLE /*_*/pagelinks (
pl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
pl_namespace INTEGER DEFAULT 0 NOT NULL,
pl_title BLOB DEFAULT '' NOT NULL,
pl_from_namespace INTEGER DEFAULT 0 NOT NULL,
PRIMARY KEY(pl_from, pl_namespace, pl_title)
);
CREATE INDEX pl_namespace ON /*_*/pagelinks (pl_namespace, pl_title, pl_from);
CREATE INDEX pl_backlinks_namespace ON /*_*/pagelinks (
pl_from_namespace, pl_namespace,
pl_title, pl_from
);
CREATE TABLE /*_*/templatelinks (
tl_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
tl_namespace INTEGER DEFAULT 0 NOT NULL,
tl_title BLOB DEFAULT '' NOT NULL,
tl_from_namespace INTEGER DEFAULT 0 NOT NULL,
PRIMARY KEY(tl_from, tl_namespace, tl_title)
);
CREATE INDEX tl_namespace ON /*_*/templatelinks (tl_namespace, tl_title, tl_from);
CREATE INDEX tl_backlinks_namespace ON /*_*/templatelinks (
tl_from_namespace, tl_namespace,
tl_title, tl_from
);
CREATE TABLE /*_*/imagelinks (
il_from INTEGER UNSIGNED DEFAULT 0 NOT NULL,
il_to BLOB DEFAULT '' NOT NULL,
il_from_namespace INTEGER DEFAULT 0 NOT NULL,
PRIMARY KEY(il_from, il_to)
);
CREATE INDEX il_to ON /*_*/imagelinks (il_to, il_from);
CREATE INDEX il_backlinks_namespace ON /*_*/imagelinks (
il_from_namespace, il_to, il_from
);