Permalink
Browse files

Fix incorrect formation of query string

removed  on ALTER COLUMN xx TYPE xxx for postgres.
Fixes #1967
  • Loading branch information...
1 parent c919b73 commit 26495b36d13ba751e2de320cdc4f41d8464448ea @siran siran committed with markstory Sep 5, 2011
Showing with 1 addition and 2 deletions.
  1. +1 −2 cake/libs/model/datasources/dbo/dbo_postgres.php
View
3 cake/libs/model/datasources/dbo/dbo_postgres.php
@@ -599,8 +599,7 @@ function alterSchema($compare, $table = null) {
$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;

0 comments on commit 26495b3

Please sign in to comment.