Skip to content

Commit

Permalink
Update according changes in ColumnSchemaInterface (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov authored Oct 1, 2024
1 parent e7d2f0b commit a87695b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 61 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Enh #314: Implement `ColumnFactory` class (@Tigrov)
- Enh #317: Separate column type constants (@Tigrov)
- Enh #318: Realize `ColumnBuilder` class (@Tigrov)
- Enh #320: Update according changes in `ColumnSchemaInterface` (@Tigrov)

## 1.2.0 March 21, 2024

Expand Down
5 changes: 2 additions & 3 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
* dflt_value:string|null,
* pk:string,
* size?: int,
* precision?: int,
* scale?: int,
* }
*/
Expand Down Expand Up @@ -346,7 +345,7 @@ protected function findColumns(TableSchemaInterface $table): bool

if ($column !== null && !strncasecmp($column->getDbType() ?? '', 'int', 3)) {
$table->sequenceName('');
$column->autoIncrement(true);
$column->autoIncrement();
}

return !empty($columns);
Expand Down Expand Up @@ -443,7 +442,7 @@ private function loadColumnSchema(array $info): ColumnSchemaInterface
$dbType = strtolower($info['type']);
$column = $columnFactory->fromDefinition($dbType, ['name' => $info['name']]);
$column->dbType($dbType);
$column->allowNull(!$info['notnull']);
$column->notNull((bool) $info['notnull']);
$column->primaryKey((bool) $info['pk']);
$column->defaultValue($this->normalizeDefaultValue($info['dflt_value'], $column));

Expand Down
Loading

0 comments on commit a87695b

Please sign in to comment.