Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed Dec 14, 2024
1 parent e332bbd commit f2a1bda
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Tempest/Database/src/QueryStatements/CharStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function compile(DatabaseDialect $dialect): string
return sprintf(
'`%s` CHAR %s %s',
$this->name,
$this->default ? "DEFAULT \"{$this->default}\"" : '',
$this->default !== null ? "DEFAULT \"{$this->default}\"" : '',
$this->nullable ? '' : 'NOT NULL',
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Tempest/Database/src/QueryStatements/DateStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function compile(DatabaseDialect $dialect): string
return sprintf(
'`%s` DATE %s %s',
$this->name,
$this->default ? "DEFAULT \"{$this->default}\"" : '',
$this->default !== null ? "DEFAULT \"{$this->default}\"" : '',
$this->nullable ? '' : 'NOT NULL',
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function compile(DatabaseDialect $dialect): string
return sprintf(
'`%s` DATETIME %s %s',
$this->name,
$this->default ? "DEFAULT \"{$this->default}\"" : '',
$this->default !== null ? "DEFAULT \"{$this->default}\"" : '',
$this->nullable ? '' : 'NOT NULL',
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function compile(DatabaseDialect $dialect): string
return sprintf(
'`%s` FLOAT %s %s',
$this->name,
$this->default ? "DEFAULT {$this->default}" : '',
$this->default !== null ? "DEFAULT {$this->default}" : '',
$this->nullable ? '' : 'NOT NULL',
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function compile(DatabaseDialect $dialect): string
'`%s` INTEGER %s %s %s',
$this->name,
$this->unsigned ? 'UNSIGNED' : '',
$this->default ? "DEFAULT {$this->default}" : '',
$this->default !== null ? "DEFAULT {$this->default}" : '',
$this->nullable ? '' : 'NOT NULL',
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Tempest/Database/src/QueryStatements/JsonStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ public function compile(DatabaseDialect $dialect): string
DatabaseDialect::SQLITE => sprintf(
'`%s` TEXT %s %s',
$this->name,
$this->default ? "DEFAULT '{$this->default}'" : '',
$this->default !== null ? "DEFAULT '{$this->default}'" : '',
$this->nullable ? '' : 'NOT NULL',
),
DatabaseDialect::POSTGRESQL => sprintf(
'`%s` JSONB %s %s',
$this->name,
$this->default ? "DEFAULT (\"{$this->default}\")" : '',
$this->default !== null ? "DEFAULT (\"{$this->default}\")" : '',
$this->nullable ? '' : 'NOT NULL',
),
};
Expand Down
2 changes: 1 addition & 1 deletion src/Tempest/Database/src/QueryStatements/TextStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function compile(DatabaseDialect $dialect): string
default => sprintf(
'`%s` TEXT %s %s',
$this->name,
$this->default ? "DEFAULT \"{$this->default}\"" : '',
$this->default !== null ? "DEFAULT \"{$this->default}\"" : '',
$this->nullable ? '' : 'NOT NULL',
),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function compile(DatabaseDialect $dialect): string
'`%s` VARCHAR(%s) %s %s',
$this->name,
$this->size,
$this->default ? "DEFAULT \"{$this->default}\"" : '',
$this->default !== null ? "DEFAULT \"{$this->default}\"" : '',
$this->nullable ? '' : 'NOT NULL',
);
}
Expand Down

0 comments on commit f2a1bda

Please sign in to comment.