diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-11-05 08:00:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-11-05 08:00:20 +0000 |
commit | 54e13b5fb421917ff4ebfeb65c85d61a8ae663b8 (patch) | |
tree | 1d4ad21fbf09f73d9ce4044df246271e9d8203a5 /database | |
parent | 745b7beda8c0d195aace8c5df17a8ff8548ad7b3 (diff) | |
download | brdo-54e13b5fb421917ff4ebfeb65c85d61a8ae663b8.tar.gz brdo-54e13b5fb421917ff4ebfeb65c85d61a8ae663b8.tar.bz2 |
- Patch #27140 by m3averck/souvent22: can't delete contact module subjects with '&' in title.
Diffstat (limited to 'database')
-rw-r--r-- | database/database.mysql | 4 | ||||
-rw-r--r-- | database/database.pgsql | 4 | ||||
-rw-r--r-- | database/updates.inc | 19 |
3 files changed, 25 insertions, 2 deletions
diff --git a/database/database.mysql b/database/database.mysql index a6a6defda..c70982086 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -204,10 +204,12 @@ CREATE TABLE comments ( -- CREATE TABLE contact ( + cid int(10) unsigned NOT NULL auto_increment, category varchar(255) NOT NULL default '', recipients longtext NOT NULL default '', reply longtext NOT NULL default '', - PRIMARY KEY (category) + PRIMARY KEY (cid), + UNIQUE KEY category (category) ) TYPE=MyISAM; -- diff --git a/database/database.pgsql b/database/database.pgsql index 717c59093..ba43d9cd9 100644 --- a/database/database.pgsql +++ b/database/database.pgsql @@ -199,10 +199,12 @@ CREATE INDEX comments_nid_idx ON comments(nid); -- CREATE TABLE contact ( + cid int NOT NULL, category varchar(255) NOT NULL default '', recipients text NOT NULL default '', reply text NOT NULL default '', - PRIMARY KEY (category) + PRIMARY KEY (cid), + UNIQUE (category) ); -- diff --git a/database/updates.inc b/database/updates.inc index eb622abd8..f7ea33041 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -103,6 +103,7 @@ $sql_updates = array( "2005-10-15" => "update_150", "2005-10-23" => "update_151", "2005-10-28" => "update_152", + "2005-11-03" => "update_153" ); function update_110() { @@ -1119,6 +1120,24 @@ function update_152() { return $ret; } +function update_153(){ + $ret = array(); + switch ($GLOBALS['db_type']) { + case 'pgsql': + $ret[] = update_sql("ALTER TABLE {contact} DROP CONSTRAINT {contact}_pkey category"); + $ret[] = update_sql("ALTER TABLE {contact} ADD COLUMN cid int PRIMARY KEY"); + $ret[] = update_sql("ALTER TABLE {contact} ADD UNIQUE (category)"); + case 'mysql': + case 'mysqli': + $ret[] = update_sql("ALTER TABLE {contact} DROP PRIMARY KEY"); + $ret[] = update_sql("ALTER TABLE {contact} ADD COLUMN cid int(11) NOT NULL PRIMARY KEY auto_increment"); + $ret[] = update_sql("ALTER TABLE {contact} ADD UNIQUE KEY category (category)"); + } + $ret = array(); + +} + + /** * Adds a column to a database. Uses syntax appropriate for PostgreSQL. |