Skip to content

Commit

Permalink
Merge pull request #62 from graze/mariaDbFix
Browse files Browse the repository at this point in the history
Fix default column for Maria DB
  • Loading branch information
brendankay authored Aug 4, 2019
2 parents 58a960b + 8b99fb1 commit c341cad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ private function getColumnDefs(array $columns)
} else {
$defColumn .= " NULL";
}
if (!is_null($column->COLUMN_DEFAULT)) {
// Maria DB defines null default columns as string 'NULL' rather than null, these need to be ignored.
if (!is_null($column->COLUMN_DEFAULT) && !($column->IS_NULLABLE == 'YES' && $column->COLUMN_DEFAULT == 'NULL')) {
if (in_array($column->DATA_TYPE, ['timestamp', 'datetime']) &&
$column->COLUMN_DEFAULT == 'CURRENT_TIMESTAMP'
) {
Expand Down

0 comments on commit c341cad

Please sign in to comment.