Skip to content

Commit

Permalink
Update according changes in ColumnSchemaInterface (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov authored Oct 1, 2024
1 parent 30513b4 commit f4183f0
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 63 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Bug #349, #352: Restore connection if closed by connection timeout (@Tigrov)
- Enh #354: Separate column type constants (@Tigrov)
- Enh #355: Realize `ColumnBuilder` class (@Tigrov)
- Enh #357: Update according changes in `ColumnSchemaInterface` (@Tigrov)

## 1.2.0 March 21, 2024

Expand Down
7 changes: 4 additions & 3 deletions src/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
* comment: string,
* enum_values?: string[],
* size?: int,
* precision?: int,
* scale?: int,
* }
* @psalm-type RowConstraint = array{
Expand Down Expand Up @@ -416,10 +415,12 @@ private function loadColumnSchema(array $info): ColumnSchemaInterface
$dbType = $info['type'];
/** @psalm-var ColumnInfoArray $info */
$column = $columnFactory->fromDefinition($dbType);
/** @psalm-suppress DeprecatedMethod */
$column->name($info['field']);
$column->allowNull($info['null'] === 'YES');
$column->primaryKey(str_contains($info['key'], 'PRI'));
$column->notNull($info['null'] !== 'YES');
$column->primaryKey($info['key'] === 'PRI');
$column->autoIncrement(stripos($info['extra'], 'auto_increment') !== false);
$column->unique($info['key'] === 'UNI');
$column->comment($info['comment']);
$column->dbType($dbType);

Expand Down
Loading

0 comments on commit f4183f0

Please sign in to comment.