@@ 493-504 (lines=12) @@ | ||
490 | * @param string $columnType column type added |
|
491 | * @return string |
|
492 | */ |
|
493 | protected function getDefaultValueDefinition($default, $columnType = null) |
|
494 | { |
|
495 | if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { |
|
496 | $default = $this->getConnection()->quote($default); |
|
497 | } elseif (is_bool($default)) { |
|
498 | $default = $this->castToBool($default); |
|
499 | } elseif ($default !== null && $columnType === static::PHINX_TYPE_BOOLEAN) { |
|
500 | $default = $this->castToBool((bool)$default); |
|
501 | } |
|
502 | ||
503 | return isset($default) ? " DEFAULT $default" : ''; |
|
504 | } |
|
505 | ||
506 | /** |
|
507 | * Executes all the ALTER TABLE instructions passed for the given table |
@@ 1082-1093 (lines=12) @@ | ||
1079 | * @param string $columnType column type added |
|
1080 | * @return string |
|
1081 | */ |
|
1082 | protected function getDefaultValueDefinition($default, $columnType = null) |
|
1083 | { |
|
1084 | if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { |
|
1085 | $default = $this->getConnection()->quote($default); |
|
1086 | } elseif (is_bool($default)) { |
|
1087 | $default = $this->castToBool($default); |
|
1088 | } elseif ($columnType === static::PHINX_TYPE_BOOLEAN) { |
|
1089 | $default = $this->castToBool((bool)$default); |
|
1090 | } |
|
1091 | ||
1092 | return isset($default) ? 'DEFAULT ' . $default : ''; |
|
1093 | } |
|
1094 | ||
1095 | /** |
|
1096 | * Gets the PostgreSQL Column Definition for a Column object. |