Skip to content

Commit

Permalink
Fix generated sql for NULL timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
colemanw authored and totten committed Apr 18, 2024
1 parent ed18b34 commit 12788a9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mixin/lib/civimix-schema/src/SqlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ private function generateCreateTableSql(array $entity): string {
if (!empty($field['required'])) {
$fieldSql .= ' NOT NULL';
}
// Mysql 5.7 requires timestamp to be explicitly declared NULL
if (empty($field['required']) && $field['sql_type'] === 'timestamp') {
$fieldSql .= ' NULL';
}
if (!empty($field['auto_increment'])) {
$fieldSql .= " AUTO_INCREMENT";
}
Expand Down

0 comments on commit 12788a9

Please sign in to comment.