| @@ 1090-1101 (lines=12) @@ | ||
| 1087 | * @param string $columnType column type added |
|
| 1088 | * @return string |
|
| 1089 | */ |
|
| 1090 | protected function getDefaultValueDefinition($default, $columnType = null) |
|
| 1091 | { |
|
| 1092 | if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { |
|
| 1093 | $default = $this->getConnection()->quote($default); |
|
| 1094 | } elseif (is_bool($default)) { |
|
| 1095 | $default = $this->castToBool($default); |
|
| 1096 | } elseif ($columnType === static::PHINX_TYPE_BOOLEAN) { |
|
| 1097 | $default = $this->castToBool((bool)$default); |
|
| 1098 | } |
|
| 1099 | ||
| 1100 | return isset($default) ? 'DEFAULT ' . $default : ''; |
|
| 1101 | } |
|
| 1102 | ||
| 1103 | /** |
|
| 1104 | * Gets the PostgreSQL Column Definition for a Column object. |
|
| @@ 574-585 (lines=12) @@ | ||
| 571 | * @param string $columnType column type added |
|
| 572 | * @return string |
|
| 573 | */ |
|
| 574 | protected function getDefaultValueDefinition($default, $columnType = null) |
|
| 575 | { |
|
| 576 | if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { |
|
| 577 | $default = $this->getConnection()->quote($default); |
|
| 578 | } elseif (is_bool($default)) { |
|
| 579 | $default = $this->castToBool($default); |
|
| 580 | } elseif ($default !== null && $columnType === static::PHINX_TYPE_BOOLEAN) { |
|
| 581 | $default = $this->castToBool((bool)$default); |
|
| 582 | } |
|
| 583 | ||
| 584 | return isset($default) ? " DEFAULT $default" : ''; |
|
| 585 | } |
|
| 586 | ||
| 587 | /** |
|
| 588 | * Executes all the ALTER TABLE instructions passed for the given table |
|