Browse Source

Fix incorrect formation of query string
removed on ALTER COLUMN xx TYPE xxx for postgres.
Fixes #1967

An M - kub2 14 years ago
parent
commit
26495b36d1
1 changed files with 1 additions and 2 deletions
  1. 1 2
      cake/libs/model/datasources/dbo/dbo_postgres.php

+ 1 - 2
cake/libs/model/datasources/dbo/dbo_postgres.php

@@ -599,8 +599,7 @@ class DboPostgres extends DboSource {
 								$default = isset($col['default']) ? $col['default'] : null;
 								$nullable = isset($col['null']) ? $col['null'] : null;
 								unset($col['default'], $col['null']);
-								$colList[] = 'ALTER COLUMN '. $fieldName .' TYPE ' . str_replace($fieldName, '', $this->buildColumn($col));
-
+								$colList[] = 'ALTER COLUMN '. $fieldName .' TYPE ' . str_replace(array($fieldName, 'NOT NULL'), '', $this->buildColumn($col));
 								if (isset($nullable)) {
 									$nullable = ($nullable) ? 'DROP NOT NULL' : 'SET NOT NULL';
 									$colList[] = 'ALTER COLUMN '. $fieldName .'  ' . $nullable;