Skip to content

Commit 521c29f

Browse files
committed
include sqlite
1 parent 55b2ee1 commit 521c29f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Phinx/Db/Adapter/SQLiteAdapter.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,8 +1868,12 @@ protected function getColumnSqlDefinition(Column $column): string
18681868
$def .= '(' . ($column->getLimit() ?: $sqlType['limit']) . ')';
18691869
}
18701870
}
1871-
if ($column->getPrecision() && $column->getScale()) {
1872-
$def .= '(' . $column->getPrecision() . ',' . $column->getScale() . ')';
1871+
if ($column->getPrecision() || $column->getScale()) {
1872+
$def .= sprintf(
1873+
'(%s, %s)',
1874+
$column->getPrecision() ?: 10,
1875+
$column->getScale() ?: 0,
1876+
);
18731877
}
18741878

18751879
$default = $column->getDefault();

tests/Phinx/Db/Adapter/SQLiteAdapterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,9 @@ public function columnsProvider()
13191319
['column15', 'smallinteger', []],
13201320
['column15', 'integer', []],
13211321
['column23', 'json', []],
1322+
['decimal_precision_scale', 'decimal', ['precision' => 10, 'scale' => 2]],
1323+
['decimal_precision_zero_scale', 'decimal', ['precision' => 10, 'scale' => 0]],
1324+
['decimal_precision', 'decimal', ['precision' => 10]],
13221325
];
13231326
}
13241327

0 commit comments

Comments
 (0)