db2 driver updates

This commit is contained in:
Mark Gregory
2026-11-11 11:16:35 +00:00
parent 84844311a5
commit 16720caf19
6 changed files with 584 additions and 1 deletions
+6 -1
View File
@@ -141,6 +141,9 @@ class Db2SchemaGrammar extends Grammar
return $schema === null ? $this->wrapValue($name) : $this->wrapValue($schema).'.'.$this->wrapValue($name);
}
/**
* Compile a Db2 column declaration for CREATE TABLE or ADD COLUMN.
*/
private function columnDefinition(Fluent $column): string
{
$sql = $this->wrap($column).' '.$this->getType($column);
@@ -151,7 +154,9 @@ class Db2SchemaGrammar extends Grammar
if (! $column->nullable) {
$sql .= ' NOT NULL';
}
if ($column->default !== null) {
if ($column->useCurrent && in_array($column->type, ['timestamp', 'dateTime'], true)) {
$sql .= ' DEFAULT CURRENT TIMESTAMP';
} elseif ($column->default !== null) {
$sql .= ' DEFAULT '.$this->getDefaultValue($column->default);
}