r70969 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70968‎ | r70969 | r70970 >
Date:16:39, 12 August 2010
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
Follow-up r68758: fixed SQLite compatibility
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.sql (modified) (history)
  • /trunk/extensions/CentralNotice/patches/patch-notice_languages.sql (modified) (history)
  • /trunk/extensions/CentralNotice/patches/patch-notice_preferred.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/patches/patch-notice_languages.sql
@@ -1,7 +1,7 @@
22 -- Update to allow for any number of languages per notice.
33
44 CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/cn_notice_languages (
5 - `id` int unsigned NOT NULL auto_increment PRIMARY KEY,
 5+ `id` int unsigned NOT NULL PRIMARY KEY auto_increment,
66 `not_id` int unsigned NOT NULL,
77 `not_language` varchar(32) NOT NULL
88 ) /*$wgDBTableOptions*/;
Index: trunk/extensions/CentralNotice/patches/patch-notice_preferred.sql
@@ -1,6 +1,6 @@
2 -# Support for one notice to supercede all others. This allows one notice to
3 -# cancel out all the templates that a non preffered notice might have if they
4 -# overlap. Use case is to be able to use one all language and projects notice
5 -# and have it superceded by a specific one for en wikipedia.
 2+-- Support for one notice to supercede all others. This allows one notice to
 3+-- cancel out all the templates that a non preffered notice might have if they
 4+-- overlap. Use case is to be able to use one all language and projects notice
 5+-- and have it superceded by a specific one for en wikipedia.
66
77 ALTER TABLE cn_notices ADD COLUMN not_preferred bool NOT NULL default '0';
Index: trunk/extensions/CentralNotice/CentralNotice.sql
@@ -1,5 +1,5 @@
22 CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/cn_notices (
3 - `not_id` int NOT NULL auto_increment,
 3+ `not_id` int NOT NULL PRIMARY KEY auto_increment,
44 `not_name` varchar(255) NOT NULL,
55 `not_start` char(14) NOT NULL,
66 `not_end` char(14) NOT NULL,
@@ -7,28 +7,25 @@
88 `not_preferred` bool NOT NULL default '0',
99 `not_locked` bool NOT NULL default '0',
1010 `not_language` varchar(32) NOT NULL,
11 - `not_project` varchar(255) NOT NULL,
12 - PRIMARY KEY (`not_id`)
 11+ `not_project` varchar(255) NOT NULL
1312 ) /*$wgDBTableOptions*/;
1413
1514 CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/cn_assignments (
16 - `asn_id` int NOT NULL auto_increment,
 15+ `asn_id` int NOT NULL PRIMARY KEY auto_increment,
1716 `not_id` int NOT NULL,
1817 `tmp_id` int NOT NULL,
19 - `tmp_weight` int NOT NULL,
20 - PRIMARY KEY (`asn_id`)
 18+ `tmp_weight` int NOT NULL
2119 ) /*$wgDBTableOptions*/;
2220
2321 CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/cn_templates (
24 - `tmp_id` int NOT NULL auto_increment,
25 - `tmp_name` varchar(255) default NULL,
26 - PRIMARY KEY (`tmp_id`)
 22+ `tmp_id` int NOT NULL PRIMARY KEY auto_increment,
 23+ `tmp_name` varchar(255) default NULL
2724 ) /*$wgDBTableOptions*/;
2825
2926 CREATE TABLE IF NOT EXISTS /*$wgDBprefix*/cn_notice_languages (
30 - `id` int unsigned NOT NULL auto_increment,
 27+ `id` int unsigned NOT NULL PRIMARY KEY auto_increment,
3128 `not_id` int unsigned NOT NULL,
32 - `not_language` varchar(32) NOT NULL,
33 - PRIMARY KEY (`id`),
34 - UNIQUE KEY `not_id_not_language` (`not_id`,`not_language`)
35 -) /*$wgDBTableOptions*/;
\ No newline at end of file
 29+ `not_language` varchar(32) NOT NULL
 30+) /*$wgDBTableOptions*/;
 31+
 32+CREATE UNIQUE KEY `not_id_not_language` ON /*_*/cn_notice_languages(`not_id`,`not_language`)

Follow-up revisions

RevisionCommit summaryAuthorDate
r71220fixing SQL error introduced in r70969, making index from r70907 UNIQUEkaldari23:38, 17 August 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r68758adding SQL patch support for auto-updatingkaldari01:32, 30 June 2010

Comments

#Comment by Kaldari (talk | contribs)   23:36, 17 August 2010

CREATE UNIQUE KEY should be CREATE UNIQUE INDEX

#Comment by Catrope (talk | contribs)   22:15, 23 August 2010

It probably was the lack of a semicolon instead: KEY and INDEX are synonyms in MySQL AFAIK.

Status & tagging log