Skip to content

Commit d3a4882

Browse files
committed
SNFLK ignore empty default
1 parent 94058a5 commit d3a4882

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/Definition/Snowflake.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ public function __construct(string $type, array $options = [])
101101
if ($diff !== []) {
102102
throw new InvalidOptionException("Option '{$diff[0]}' not supported");
103103
}
104+
if (array_key_exists('default', $options) && $options['default'] === '') {
105+
unset($options['default']);
106+
}
104107
parent::__construct($type, $options);
105108
}
106109

tests/SnowflakeDatatypeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ public function testSqlDefinition(): void
124124
$definition = new Snowflake('NUMERIC', ['length' => '10,10', 'nullable' => true, 'default' => '10']);
125125
$this->assertSame($definition->getSQLDefinition(), 'NUMERIC (10,10) DEFAULT 10');
126126

127+
$definition = new Snowflake('NUMERIC', ['length' => '10,10', 'nullable' => true, 'default' => '']);
128+
$this->assertSame($definition->getSQLDefinition(), 'NUMERIC (10,10)');
129+
127130
$definition = new Snowflake('TIMESTAMP_TZ', ['length' => '0']);
128131
$this->assertSame($definition->getSQLDefinition(), 'TIMESTAMP_TZ (0)');
129132

0 commit comments

Comments
 (0)