Skip to content

Commit

Permalink
Don't force boolean fields to be NOT NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw committed Apr 16, 2024
1 parent 59aed5d commit b63ecd3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mixin/lib/civimix-schema/src/SqlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ private function generateCreateTableSql(array $entity): string {
$fieldSql .= " COLLATE {$field['collate']}";
}
// Required fields and booleans cannot be null
if (!empty($field['required']) || $field['sql_type'] === 'boolean') {
// FIXME: For legacy support this doesn't force boolean fields to be NOT NULL... but it really should.
if (!empty($field['required'])) {
$fieldSql .= ' NOT NULL';
}
if (!empty($field['auto_increment'])) {
Expand Down

0 comments on commit b63ecd3

Please sign in to comment.