diff options
author | Nils Adermann <naderman@naderman.de> | 2010-01-26 02:06:37 +0000 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2010-01-26 02:06:37 +0000 |
commit | 870921c87231c1e637de76295914be53b846469a (patch) | |
tree | 6686c3c358f2fae6be0792466a2735bbb8a9451a /phpBB | |
parent | 5306a586b17d0c85d6a52dea994806bbb1891e50 (diff) | |
download | forums-870921c87231c1e637de76295914be53b846469a.tar forums-870921c87231c1e637de76295914be53b846469a.tar.gz forums-870921c87231c1e637de76295914be53b846469a.tar.bz2 forums-870921c87231c1e637de76295914be53b846469a.tar.xz forums-870921c87231c1e637de76295914be53b846469a.zip |
Database updater now separates ADD COLUMN from SET NOT NULL and SET DEFAULT, when using PostgreSQL <= 7.4 [Bug #54435]
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10446 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 3 | ||||
-rw-r--r-- | phpBB/includes/db/db_tools.php | 24 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 24 |
3 files changed, 48 insertions, 3 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e95d7c7791..1ddee3b573 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -131,7 +131,7 @@ <li>[Fix] Pagination of User Notes in MCP uses two different config values. (Bug #56025)</li> <li>[Fix] List hidden groups on viewprofile where the viewing user is also a member. (Bug #31845)</li> <li>[Fix] Sort viewprofile group list by group name.</li> - <li>[Fix] Strictly check whether a moderator can post in the destination forum when moving topic. (Bug #56255)</li> + <li>[Fix] Strictly check whether a moderator can post in the destination forum when moving topic. (Bug #56255)</li> <li>[Fix] Added some error handling to the compress class.</li> <li>[Fix] Correctly determine permissions to show quick reply button. (Bug #56555)</li> <li>[Fix] Do not unsubscribe users from topics replying with quickreply. (Bug #56235)</li> @@ -147,6 +147,7 @@ <li>[Fix] Correctly orientate quoted text image on RTL languages. (Bug #33745)</li> <li>[Fix] Deprecate $allow_reply parameter to truncate_string() (Bug #56675)</li> <li>[Fix] Update users last visit field correctly when changing activation status. (Bug #56185)</li> + <li>[Fix] Database updater now separates ADD COLUMN from SET NOT NULL and SET DEFAULT, when using PostgreSQL <= 7.4 (Bug #54435)</li> <li>[Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)</li> <li>[Change] Log activation through inactive users ACP. (Bug #30145)</li> <li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li> diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index a762b31681..7123c83e51 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -1348,7 +1348,29 @@ class phpbb_db_tools break; case 'postgres': - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; + if (version_compare($this->db->sql_server_info(true), '8.0', '>=')) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; + } + else + { + // old versions cannot add columns with default and null information + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type'] . ' ' . $column_data['constraint']; + + if (isset($column_data['null'])) + { + if ($column_data['null'] == 'NOT NULL') + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + } + + if (isset($column_data['default'])) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; + } + } + break; case 'sqlite': diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 31911b4a6c..36a09e5ec4 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -2924,7 +2924,29 @@ class updater_db_tools case 'postgres': // Does not support AFTER, only through temporary table - $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; + + if (version_compare($this->db->sql_server_info(true), '8.0', '>=')) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; + } + else + { + // old versions cannot add columns with default and null information + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type'] . ' ' . $column_data['constraint']; + + if (isset($column_data['null'])) + { + if ($column_data['null'] == 'NOT NULL') + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + } + + if (isset($column_data['default'])) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; + } + } break; case 'sqlite': |