diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-07-28 11:52:48 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-07-28 11:52:48 +0200 |
commit | 222b01f5169f1c7e69762e0e8904c24f78f71882 (patch) | |
tree | 8e932e12546bb991357ec48eb1638d1770be7a35 /maintenance/postgres | |
parent | 00ab76a6b686e98a914afc1975812d2b1aaa7016 (diff) |
update to MediaWiki 1.16.0
Diffstat (limited to 'maintenance/postgres')
-rw-r--r-- | maintenance/postgres/archives/patch-l10n_cache.sql | 8 | ||||
-rw-r--r-- | maintenance/postgres/archives/patch-log_search.sql | 9 | ||||
-rw-r--r-- | maintenance/postgres/archives/patch-update_sequences.sql | 20 | ||||
-rw-r--r-- | maintenance/postgres/archives/patch-user_properties.sql | 8 | ||||
-rw-r--r-- | maintenance/postgres/compare_schemas.pl | 15 | ||||
-rw-r--r-- | maintenance/postgres/mediawiki_mysql2postgres.pl | 6 | ||||
-rw-r--r-- | maintenance/postgres/tables.sql | 71 |
7 files changed, 115 insertions, 22 deletions
diff --git a/maintenance/postgres/archives/patch-l10n_cache.sql b/maintenance/postgres/archives/patch-l10n_cache.sql new file mode 100644 index 00000000..9b39b1b7 --- /dev/null +++ b/maintenance/postgres/archives/patch-l10n_cache.sql @@ -0,0 +1,8 @@ +CREATE TABLE l10n_cache ( + lc_lang TEXT NOT NULL, + lc_key TEXT NOT NULL, + lc_value TEXT NOT NULL +); +CREATE INDEX l10n_cache_lc_lang_key ON l10n_cache (lc_lang, lc_key); + + diff --git a/maintenance/postgres/archives/patch-log_search.sql b/maintenance/postgres/archives/patch-log_search.sql new file mode 100644 index 00000000..20a61fd7 --- /dev/null +++ b/maintenance/postgres/archives/patch-log_search.sql @@ -0,0 +1,9 @@ + +CREATE TABLE log_search ( + ls_field TEXT NOT NULL, + ls_value TEXT NOT NULL, + ls_log_id INTEGER NOT NULL DEFAULT 0 +); + +ALTER TABLE log_search ADD CONSTRAINT log_search_pk PRIMARY KEY(ls_field, ls_value, ls_log_id); +CREATE INDEX ls_log_id ON log_search (ls_log_id); diff --git a/maintenance/postgres/archives/patch-update_sequences.sql b/maintenance/postgres/archives/patch-update_sequences.sql new file mode 100644 index 00000000..a3d30681 --- /dev/null +++ b/maintenance/postgres/archives/patch-update_sequences.sql @@ -0,0 +1,20 @@ +ALTER SEQUENCE rev_rev_id_val RENAME TO revision_rev_id_seq; +ALTER TABLE revision ALTER COLUMN rev_id SET DEFAULT NEXTVAL('revision_rev_id_seq'); + +ALTER SEQUENCE text_old_id_val RENAME TO text_old_id_seq; +ALTER TABLE pagecontent ALTER COLUMN old_id SET DEFAULT nextval('text_old_id_seq'); + +ALTER SEQUENCE category_id_seq RENAME TO category_cat_id_seq; +ALTER TABLE category ALTER COLUMN cat_id SET DEFAULT nextval('category_cat_id_seq'); + +ALTER SEQUENCE ipblocks_ipb_id_val RENAME TO ipblocks_ipb_id_seq; +ALTER TABLE ipblocks ALTER COLUMN ipb_id SET DEFAULT nextval('ipblocks_ipb_id_seq'); + +ALTER SEQUENCE rc_rc_id_seq RENAME TO recentchanges_rc_id_seq; +ALTER TABLE recentchanges ALTER COLUMN rc_id SET DEFAULT nextval('recentchanges_rc_id_seq'); + +ALTER SEQUENCE log_log_id_seq RENAME TO logging_log_id_seq; +ALTER TABLE logging ALTER COLUMN log_id SET DEFAULT nextval('logging_log_id_seq'); + +ALTER SEQUENCE pr_id_val RENAME TO page_restrictions_pr_id_seq; +ALTER TABLE page_restrictions ALTER COLUMN pr_id SET DEFAULT nextval('page_restrictions_pr_id_seq'); diff --git a/maintenance/postgres/archives/patch-user_properties.sql b/maintenance/postgres/archives/patch-user_properties.sql new file mode 100644 index 00000000..b40fa85f --- /dev/null +++ b/maintenance/postgres/archives/patch-user_properties.sql @@ -0,0 +1,8 @@ +CREATE TABLE user_properties( + up_user INTEGER NULL REFERENCES mwuser(user_id) ON DELETE CASCADE, + up_property TEXT NOT NULL, + up_value TEXT +); + +CREATE UNIQUE INDEX user_properties_user_property on user_properties (up_user,up_property); +CREATE INDEX user_properties_property on user_properties (up_property); diff --git a/maintenance/postgres/compare_schemas.pl b/maintenance/postgres/compare_schemas.pl index 850244ba..9bddf504 100644 --- a/maintenance/postgres/compare_schemas.pl +++ b/maintenance/postgres/compare_schemas.pl @@ -129,6 +129,8 @@ sub parse_sql { } elsif (m{^CREATE (?:UNIQUE )?(?:FULLTEXT )?INDEX /\*i\*/(\w+) ON /\*_\*/(\w+) \((.+?)\);}) { } + elsif (m{^\s*PRIMARY KEY \([\w,]+\)}) { + } else { die "Cannot parse line $. of $oldfile:\n$_\n"; } @@ -258,6 +260,9 @@ while (<$newfh>) { } $lastcomma = $3 ? 1 : 0; } + elsif (m{^\s*PRIMARY KEY \([\w,]+\)}) { + $lastcomma = 0; + } else { die "Cannot parse line $. of $new:\n$_\n"; } @@ -302,7 +307,8 @@ ar_comment tinyblob TEXT fa_description tinyblob TEXT img_description tinyblob TEXT ipb_reason tinyblob TEXT -log_action varbinary(10) TEXT +log_action varbinary(32) TEXT +log_type varbinary(32) TEXT oi_description tinyblob TEXT rev_comment tinyblob TEXT rc_log_action varbinary(255) TEXT @@ -318,12 +324,17 @@ ipb_address tinyblob TEXT # IP address or username ipb_range_end tinyblob TEXT # hexadecimal ipb_range_start tinyblob TEXT # hexadecimal img_minor_mime varbinary(32) TEXT +lc_lang varbinary(32) TEXT +lc_value varbinary(32) TEXT + img_sha1 varbinary(32) TEXT job_cmd varbinary(60) TEXT # Should we limit to 60 as well? keyname varbinary(255) TEXT # No tablename prefix (objectcache) ll_lang varbinary(20) TEXT # Language code +lc_value mediumblob TEXT log_params blob TEXT # LF separated list of args log_type varbinary(10) TEXT +ls_field varbinary(32) TEXT oi_minor_mime varbinary(32) TEXT oi_sha1 varbinary(32) TEXT old_flags tinyblob TEXT @@ -343,6 +354,8 @@ rc_params blob TEXT rlc_to_blob blob TEXT ts_tags blob TEXT ug_group varbinary(16) TEXT +up_property varbinary(32) TEXT +up_value blob TEXT user_email_token binary(32) TEXT user_ip varbinary(40) TEXT user_newpassword tinyblob TEXT diff --git a/maintenance/postgres/mediawiki_mysql2postgres.pl b/maintenance/postgres/mediawiki_mysql2postgres.pl index a3b17f94..220c779b 100644 --- a/maintenance/postgres/mediawiki_mysql2postgres.pl +++ b/maintenance/postgres/mediawiki_mysql2postgres.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl ## Convert data from a MySQL mediawiki database into a Postgres mediawiki database -## svn: $Id: mediawiki_mysql2postgres.pl 43845 2008-11-22 06:44:45Z greg $ +## svn: $Id: mediawiki_mysql2postgres.pl 59489 2009-11-27 15:34:54Z greg $ ## NOTE: It is probably easier to dump your wiki using maintenance/dumpBackup.php ## and then import it with maintenance/importDump.php @@ -181,7 +181,7 @@ $MYSQLSOCKET and $conninfo .= "\n-- socket $MYSQLSOCKET"; print qq{ -- Dump of MySQL Mediawiki tables for import into a Postgres Mediawiki schema -- Performed by the program: $0 --- Version: $VERSION (subversion }.q{$LastChangedRevision: 43845 $}.qq{) +-- Version: $VERSION (subversion }.q{$LastChangedRevision: 59489 $}.qq{) -- Author: Greg Sabino Mullane <greg\@turnstep.com> Comments welcome -- -- This file was created: $now @@ -416,7 +416,7 @@ SELECT setval('page_page_id_seq', 1+coalesce(max(page_id),0),false) FROM pa SELECT setval('pr_id_val', 1+coalesce(max(pr_id) ,0),false) FROM page_restrictions; SELECT setval('rc_rc_id_seq', 1+coalesce(max(rc_id) ,0),false) FROM recentchanges; SELECT setval('rev_rev_id_val', 1+coalesce(max(rev_id) ,0),false) FROM revision; -SELECT setval('text_old_id_val', 1+coalesce(max(old_id) ,0),false) FROM pagecontent; +SELECT setval('text_old_id_seq', 1+coalesce(max(old_id) ,0),false) FROM pagecontent; SELECT setval('trackbacks_tb_id_seq', 1+coalesce(max(tb_id) ,0),false) FROM trackbacks; SELECT setval('user_user_id_seq', 1+coalesce(max(user_id),0),false) FROM mwuser; }; diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql index 23e8b596..38b607d9 100644 --- a/maintenance/postgres/tables.sql +++ b/maintenance/postgres/tables.sql @@ -82,9 +82,9 @@ $mw$; CREATE TRIGGER page_deleted AFTER DELETE ON page FOR EACH ROW EXECUTE PROCEDURE page_deleted(); -CREATE SEQUENCE rev_rev_id_val; +CREATE SEQUENCE revision_rev_id_seq; CREATE TABLE revision ( - rev_id INTEGER NOT NULL UNIQUE DEFAULT nextval('rev_rev_id_val'), + rev_id INTEGER NOT NULL UNIQUE DEFAULT nextval('revision_rev_id_seq'), rev_page INTEGER NULL REFERENCES page (page_id) ON DELETE CASCADE, rev_text_id INTEGER NULL, -- FK rev_comment TEXT, @@ -103,17 +103,17 @@ CREATE INDEX rev_user_idx ON revision (rev_user); CREATE INDEX rev_user_text_idx ON revision (rev_user_text); -CREATE SEQUENCE text_old_id_val; +CREATE SEQUENCE text_old_id_seq; CREATE TABLE pagecontent ( -- replaces reserved word 'text' - old_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('text_old_id_val'), + old_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('text_old_id_seq'), old_text TEXT, old_flags TEXT ); -CREATE SEQUENCE pr_id_val; +CREATE SEQUENCE page_restrictions_pr_id_seq; CREATE TABLE page_restrictions ( - pr_id INTEGER NOT NULL UNIQUE DEFAULT nextval('pr_id_val'), + pr_id INTEGER NOT NULL UNIQUE DEFAULT nextval('page_restrictions_pr_id_seq'), pr_page INTEGER NULL REFERENCES page (page_id) ON DELETE CASCADE, pr_type TEXT NOT NULL, pr_level TEXT NOT NULL, @@ -155,7 +155,9 @@ CREATE INDEX archive_user_text ON archive (ar_user_text); CREATE TABLE redirect ( rd_from INTEGER NOT NULL REFERENCES page(page_id) ON DELETE CASCADE, rd_namespace SMALLINT NOT NULL, - rd_title TEXT NOT NULL + rd_title TEXT NOT NULL, + rd_interwiki TEXT NULL, + rd_fragment TEXT NULL ); CREATE INDEX redirect_ns_title ON redirect (rd_namespace,rd_title,rd_from); @@ -198,6 +200,13 @@ CREATE TABLE externallinks ( CREATE INDEX externallinks_from_to ON externallinks (el_from,el_to); CREATE INDEX externallinks_index ON externallinks (el_index); +CREATE TABLE external_user ( + eu_local_id INTEGER NOT NULL PRIMARY KEY, + eu_external_id TEXT +); + +CREATE UNIQUE INDEX eu_external_id ON external_user (eu_external_id); + CREATE TABLE langlinks ( ll_from INTEGER NOT NULL REFERENCES page (page_id) ON DELETE CASCADE, ll_lang TEXT, @@ -224,9 +233,9 @@ CREATE TABLE hitcounter ( ); -CREATE SEQUENCE ipblocks_ipb_id_val; +CREATE SEQUENCE ipblocks_ipb_id_seq; CREATE TABLE ipblocks ( - ipb_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('ipblocks_ipb_id_val'), + ipb_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('ipblocks_ipb_id_seq'), ipb_address TEXT NULL, ipb_user INTEGER NULL REFERENCES mwuser(user_id) ON DELETE SET NULL, ipb_by INTEGER NOT NULL REFERENCES mwuser(user_id) ON DELETE CASCADE, @@ -288,7 +297,7 @@ CREATE TABLE oldimage ( oi_deleted SMALLINT NOT NULL DEFAULT 0, oi_sha1 TEXT NOT NULL DEFAULT '' ); -ALTER TABLE oldimage ADD CONSTRAINT oldimage_oi_name_fkey_cascade FOREIGN KEY (oi_name) REFERENCES image(img_name) ON DELETE CASCADE; +ALTER TABLE oldimage ADD CONSTRAINT oldimage_oi_name_fkey_cascaded FOREIGN KEY (oi_name) REFERENCES image(img_name) ON DELETE CASCADE ON UPDATE CASCADE; CREATE INDEX oi_name_timestamp ON oldimage (oi_name,oi_timestamp); CREATE INDEX oi_name_archive_name ON oldimage (oi_name,oi_archive_name); CREATE INDEX oi_sha1 ON oldimage (oi_sha1); @@ -324,9 +333,9 @@ CREATE INDEX fa_notime ON filearchive (fa_deleted_timestamp); CREATE INDEX fa_nouser ON filearchive (fa_deleted_user); -CREATE SEQUENCE rc_rc_id_seq; +CREATE SEQUENCE recentchanges_rc_id_seq; CREATE TABLE recentchanges ( - rc_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('rc_rc_id_seq'), + rc_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('recentchanges_rc_id_seq'), rc_timestamp TIMESTAMPTZ NOT NULL, rc_cur_time TIMESTAMPTZ NOT NULL, rc_user INTEGER NULL REFERENCES mwuser(user_id) ON DELETE SET NULL, @@ -426,9 +435,9 @@ CREATE TABLE transcache ( ); -CREATE SEQUENCE log_log_id_seq; +CREATE SEQUENCE logging_log_id_seq; CREATE TABLE logging ( - log_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('log_log_id_seq'), + log_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('logging_log_id_seq'), log_type TEXT NOT NULL, log_action TEXT NOT NULL, log_timestamp TIMESTAMPTZ NOT NULL, @@ -437,12 +446,24 @@ CREATE TABLE logging ( log_title TEXT NOT NULL, log_comment TEXT, log_params TEXT, - log_deleted SMALLINT NOT NULL DEFAULT 0 + log_deleted SMALLINT NOT NULL DEFAULT 0, + log_user_text TEXT NOT NULL DEFAULT '', + log_page INTEGER ); CREATE INDEX logging_type_name ON logging (log_type, log_timestamp); CREATE INDEX logging_user_time ON logging (log_timestamp, log_user); CREATE INDEX logging_page_time ON logging (log_namespace, log_title, log_timestamp); +CREATE INDEX logging_times ON logging (log_timestamp); +CREATE INDEX logging_user_type_time ON logging (log_user, log_type, log_timestamp); +CREATE INDEX logging_page_id_time ON logging (log_page, log_timestamp); +CREATE TABLE log_search ( + ls_field TEXT NOT NULL, + ls_value TEXT NOT NULL, + ls_log_id INTEGER NOT NULL DEFAULT 0, + PRIMARY KEY (ls_field,ls_value,ls_log_id) +); +CREATE INDEX ls_log_id ON log_search (ls_log_id); CREATE SEQUENCE trackbacks_tb_id_seq; CREATE TABLE trackbacks ( @@ -542,9 +563,9 @@ CREATE TABLE updatelog ( ); -CREATE SEQUENCE category_id_seq; +CREATE SEQUENCE category_cat_id_seq; CREATE TABLE category ( - cat_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('category_id_seq'), + cat_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('category_cat_id_seq'), cat_title TEXT NOT NULL, cat_pages INTEGER NOT NULL DEFAULT 0, cat_subcats INTEGER NOT NULL DEFAULT 0, @@ -580,6 +601,14 @@ CREATE TABLE valid_tag ( vt_tag TEXT NOT NULL PRIMARY KEY ); +CREATE TABLE user_properties ( + up_user INTEGER NULL REFERENCES mwuser(user_id) ON DELETE CASCADE, + up_property TEXT NOT NULL, + up_value TEXT +); +CREATE UNIQUE INDEX user_properties_user_property ON user_properties (up_user,up_property); +CREATE INDEX user_properties_property ON user_properties (up_property); + CREATE TABLE mediawiki_version ( type TEXT NOT NULL, mw_version TEXT NOT NULL, @@ -599,5 +628,11 @@ CREATE TABLE mediawiki_version ( ); INSERT INTO mediawiki_version (type,mw_version,sql_version,sql_date) - VALUES ('Creation','??','$LastChangedRevision: 48615 $','$LastChangedDate: 2009-03-20 12:15:41 +1100 (Fri, 20 Mar 2009) $'); + VALUES ('Creation','??','$LastChangedRevision: 59842 $','$LastChangedDate: 2009-12-09 06:32:17 +1100 (Wed, 09 Dec 2009) $'); +CREATE TABLE l10n_cache ( + lc_lang TEXT NOT NULL, + lc_key TEXT NOT NULL, + lc_value TEXT NOT NULL +); +CREATE INDEX l10n_cache_lc_lang_key ON l10n_cache (lc_lang, lc_key); |