summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/database/pgsql/schema.inc10
1 files changed, 10 insertions, 0 deletions
diff --git a/includes/database/pgsql/schema.inc b/includes/database/pgsql/schema.inc
index 1443bc5c0..f05cc0868 100644
--- a/includes/database/pgsql/schema.inc
+++ b/includes/database/pgsql/schema.inc
@@ -489,6 +489,16 @@ class DatabaseSchema_pgsql extends DatabaseSchema {
$this->connection->query('ALTER TABLE {' . $table . '} ALTER "' . $field . '" TYPE ' . $typecast . ' USING "' . $field . '"::' . $typecast);
+ if (isset($spec['not null'])) {
+ if ($spec['not null']) {
+ $nullaction = 'SET NOT NULL';
+ }
+ else {
+ $nullaction = 'DROP NOT NULL';
+ }
+ $this->connection->query('ALTER TABLE {' . $table . '} ALTER "' . $field . '" ' . $nullaction);
+ }
+
if (in_array($spec['pgsql_type'], array('serial', 'bigserial'))) {
// Type "serial" is known to PostgreSQL, but *only* during table creation,
// not when altering. Because of that, the sequence needs to be created