mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 15:39:53 +00:00
Using value() in default value generation with CakeSchema and DboPostgres
This commit is contained in:
parent
13996e94c7
commit
bbf96567eb
2 changed files with 2 additions and 2 deletions
|
@ -600,7 +600,7 @@ class DboPostgres extends DboSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($default)) {
|
if (isset($default)) {
|
||||||
$colList[] = 'ALTER COLUMN '. $fieldName .' SET DEFAULT ' . $default;
|
$colList[] = 'ALTER COLUMN '. $fieldName .' SET DEFAULT ' . $this->value($default, $field);
|
||||||
} else {
|
} else {
|
||||||
$colList[] = 'ALTER COLUMN '. $fieldName .' DROP DEFAULT';
|
$colList[] = 'ALTER COLUMN '. $fieldName .' DROP DEFAULT';
|
||||||
}
|
}
|
||||||
|
|
|
@ -655,7 +655,7 @@ class DboPostgresTest extends CakeTestCase {
|
||||||
'alter_posts' => array(
|
'alter_posts' => array(
|
||||||
'id' => array('type' => 'integer', 'key' => 'primary'),
|
'id' => array('type' => 'integer', 'key' => 'primary'),
|
||||||
'author_id' => array('type' => 'integer', 'null' => true),
|
'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),
|
'body' => array('type' => 'string', 'length' => 500),
|
||||||
'status' => array('type' => 'integer', 'length' => 3, 'default' => 1),
|
'status' => array('type' => 'integer', 'length' => 3, 'default' => 1),
|
||||||
'created' => array('type' => 'datetime'),
|
'created' => array('type' => 'datetime'),
|
||||||
|
|
Loading…
Add table
Reference in a new issue