Skip to content

Commit

Permalink
IBX-1247: Promoted scale & precision as top-level field options
Browse files Browse the repository at this point in the history
  • Loading branch information
Steveb-p committed Oct 13, 2021
1 parent d0c7dab commit 64f7092
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/Importer/SchemaImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ private function addSchemaTableColumns(Table $table, array $columnList): void
$columnConfiguration['options']['length'] = $columnConfiguration['length'];
}

if (isset($columnConfiguration['scale'])) {
$columnConfiguration['options']['scale'] = $columnConfiguration['scale'];
}

if (isset($columnConfiguration['precision'])) {
$columnConfiguration['options']['precision'] = $columnConfiguration['precision'];
}

$column = $table->addColumn(
$columnName,
$columnConfiguration['type'],
Expand Down
16 changes: 16 additions & 0 deletions tests/lib/Importer/SchemaImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,22 @@ public function providerForTestImportFromFile(): array
]
),
],
7 => [
'07-numeric-options.yaml',
new Schema(
[
new Table(
'my_table',
[
(new Column(
'data',
Type::getType('decimal'))
)->setPrecision(19)->setScale(4),
]
),
]
),
],
];

return $data;
Expand Down
4 changes: 4 additions & 0 deletions tests/lib/Importer/_fixtures/07-numeric-options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tables:
my_table:
fields:
data: { type: decimal, precision: 19, scale: 4 }

0 comments on commit 64f7092

Please sign in to comment.