Skip to content

Commit

Permalink
Merge pull request #162 from bowphp/fix-set-default-value-on-migration
Browse files Browse the repository at this point in the history
[5.x] Fix set the default value on migration
  • Loading branch information
papac authored Mar 15, 2023
2 parents abcc231 + 53dd5e0 commit fea5e17
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Database/Migration/SQLGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,10 @@ private function composeAddColumn(string $name, array $description): string
}

// Add default value
if ($default) {
if (!is_null($default)) {
if (is_bool($default)) {
$default = $default ? 'true' : 'false';
}
$type = sprintf('%s DEFAULT %s', $type, $default);
}

Expand Down

0 comments on commit fea5e17

Please sign in to comment.