Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Using value() in default value generation with CakeSchema and DboPost…

…gres
  • Loading branch information...
commit bbf96567ebcdad6d2177dccbc2913a51a7fd1c51 1 parent 13996e9
@lorenzo lorenzo authored
View
2  cake/libs/model/datasources/dbo/dbo_postgres.php
@@ -600,7 +600,7 @@ function alterSchema($compare, $table = null) {
}
if (isset($default)) {
- $colList[] = 'ALTER COLUMN '. $fieldName .' SET DEFAULT ' . $default;
+ $colList[] = 'ALTER COLUMN '. $fieldName .' SET DEFAULT ' . $this->value($default, $field);
} else {
$colList[] = 'ALTER COLUMN '. $fieldName .' DROP DEFAULT';
}
View
2  cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
@@ -655,7 +655,7 @@ function testAlterSchema() {
'alter_posts' => array(
'id' => array('type' => 'integer', 'key' => 'primary'),
'author_id' => array('type' => 'integer', 'null' => true),
- 'title' => array('type' => 'string', 'null' => false),
+ 'title' => array('type' => 'string', 'null' => false, 'default' => 'my title'),
'body' => array('type' => 'string', 'length' => 500),
'status' => array('type' => 'integer', 'length' => 3, 'default' => 1),
'created' => array('type' => 'datetime'),
Please sign in to comment.
Something went wrong with that request. Please try again.