aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/install/database_update.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-01-26 02:06:37 +0000
committerNils Adermann <naderman@naderman.de>2010-01-26 02:06:37 +0000
commit870921c87231c1e637de76295914be53b846469a (patch)
tree6686c3c358f2fae6be0792466a2735bbb8a9451a /phpBB/install/database_update.php
parent5306a586b17d0c85d6a52dea994806bbb1891e50 (diff)
downloadforums-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/install/database_update.php')
-rw-r--r--phpBB/install/database_update.php24
1 files changed, 23 insertions, 1 deletions
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':