| @@ 1080-1091 (lines=12) @@ | ||
| 1077 | * @param string $columnType column type added |
|
| 1078 | * @return string |
|
| 1079 | */ |
|
| 1080 | protected function getDefaultValueDefinition($default, $columnType = null) |
|
| 1081 | { |
|
| 1082 | if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { |
|
| 1083 | $default = $this->getConnection()->quote($default); |
|
| 1084 | } elseif (is_bool($default)) { |
|
| 1085 | $default = $this->castToBool($default); |
|
| 1086 | } elseif ($columnType === static::PHINX_TYPE_BOOLEAN) { |
|
| 1087 | $default = $this->castToBool((bool)$default); |
|
| 1088 | } |
|
| 1089 | ||
| 1090 | return isset($default) ? 'DEFAULT ' . $default : ''; |
|
| 1091 | } |
|
| 1092 | ||
| 1093 | /** |
|
| 1094 | * Gets the PostgreSQL Column Definition for a Column object. |
|
| @@ 549-560 (lines=12) @@ | ||
| 546 | * @param string $columnType column type added |
|
| 547 | * @return string |
|
| 548 | */ |
|
| 549 | protected function getDefaultValueDefinition($default, $columnType = null) |
|
| 550 | { |
|
| 551 | if (is_string($default) && 'CURRENT_TIMESTAMP' !== $default) { |
|
| 552 | $default = $this->getConnection()->quote($default); |
|
| 553 | } elseif (is_bool($default)) { |
|
| 554 | $default = $this->castToBool($default); |
|
| 555 | } elseif ($default !== null && $columnType === static::PHINX_TYPE_BOOLEAN) { |
|
| 556 | $default = $this->castToBool((bool)$default); |
|
| 557 | } |
|
| 558 | ||
| 559 | return isset($default) ? " DEFAULT $default" : ''; |
|
| 560 | } |
|
| 561 | ||
| 562 | /** |
|
| 563 | * Executes all the ALTER TABLE instructions passed for the given table |
|