Skip to content
This repository
Browse code

Fix incorrect formation of query string

removed  on ALTER COLUMN xx TYPE xxx for postgres.
Fixes #1967
  • Loading branch information...
commit 26495b36d13ba751e2de320cdc4f41d8464448ea 1 parent c919b73
siran siran authored markstory committed

Showing 1 changed file with 1 addition and 2 deletions. Show diff stats Hide diff stats

  1. +1 2  cake/libs/model/datasources/dbo/dbo_postgres.php
3  cake/libs/model/datasources/dbo/dbo_postgres.php
@@ -599,8 +599,7 @@ function alterSchema($compare, $table = null) {
599 599 $default = isset($col['default']) ? $col['default'] : null;
600 600 $nullable = isset($col['null']) ? $col['null'] : null;
601 601 unset($col['default'], $col['null']);
602   - $colList[] = 'ALTER COLUMN '. $fieldName .' TYPE ' . str_replace($fieldName, '', $this->buildColumn($col));
603   -
  602 + $colList[] = 'ALTER COLUMN '. $fieldName .' TYPE ' . str_replace(array($fieldName, 'NOT NULL'), '', $this->buildColumn($col));
604 603 if (isset($nullable)) {
605 604 $nullable = ($nullable) ? 'DROP NOT NULL' : 'SET NOT NULL';
606 605 $colList[] = 'ALTER COLUMN '. $fieldName .' ' . $nullable;

0 comments on commit 26495b3

Please sign in to comment.
Something went wrong with that request. Please try again.