summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2011-04-10 23:45:30 +0200
committerDries Buytaert <dries@buytaert.net>2011-04-10 23:45:30 +0200
commit1e0b3e25e3041c286eef6da7801a5dfeac7e53b9 (patch)
treebba0ed0e9b69ad2a453a842a0ecf10f703b02363 /includes
parent0d05031835c269ff76600ffe30cd24340ecffcf0 (diff)
downloadbrdo-1e0b3e25e3041c286eef6da7801a5dfeac7e53b9.tar.gz
brdo-1e0b3e25e3041c286eef6da7801a5dfeac7e53b9.tar.bz2
- Patch #935258 by Stevel, Josh Waihi: defaults not changed in changeField on postgresql.
Diffstat (limited to 'includes')
-rw-r--r--includes/database/pgsql/schema.inc8
1 files changed, 8 insertions, 0 deletions
diff --git a/includes/database/pgsql/schema.inc b/includes/database/pgsql/schema.inc
index 01e7c7c25..9ed8a2620 100644
--- a/includes/database/pgsql/schema.inc
+++ b/includes/database/pgsql/schema.inc
@@ -527,6 +527,9 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
$this->connection->query('ALTER TABLE {' . $table . '} DROP CONSTRAINT "' . $check . '"');
}
+ // Remove old default.
+ $this->fieldSetNoDefault($table, $field);
+
$this->connection->query('ALTER TABLE {' . $table . '} ALTER "' . $field . '" TYPE ' . $typecast . ' USING "' . $field . '"::' . $typecast);
if (isset($spec['not null'])) {
@@ -561,6 +564,11 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
$this->connection->query('ALTER TABLE {' . $table . '} ADD CHECK ("' . $field_new . '" >= 0)');
}
+ // Add default if necessary.
+ if (isset($spec['default'])) {
+ $this->fieldSetDefault($table, $field_new, $spec['default']);
+ }
+
// Change description if necessary.
if (!empty($spec['description'])) {
$this->connection->query('COMMENT ON COLUMN {' . $table . '}."' . $field_new . '" IS ' . $this->prepareComment($spec['description']));