Skip to content

Commit f4183f0

Browse files
authored
Update according changes in ColumnSchemaInterface (#357)
1 parent 30513b4 commit f4183f0

File tree

4 files changed

+116
-63
lines changed

4 files changed

+116
-63
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- Bug #349, #352: Restore connection if closed by connection timeout (@Tigrov)
1414
- Enh #354: Separate column type constants (@Tigrov)
1515
- Enh #355: Realize `ColumnBuilder` class (@Tigrov)
16+
- Enh #357: Update according changes in `ColumnSchemaInterface` (@Tigrov)
1617

1718
## 1.2.0 March 21, 2024
1819

src/Schema.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
* comment: string,
5151
* enum_values?: string[],
5252
* size?: int,
53-
* precision?: int,
5453
* scale?: int,
5554
* }
5655
* @psalm-type RowConstraint = array{
@@ -416,10 +415,12 @@ private function loadColumnSchema(array $info): ColumnSchemaInterface
416415
$dbType = $info['type'];
417416
/** @psalm-var ColumnInfoArray $info */
418417
$column = $columnFactory->fromDefinition($dbType);
418+
/** @psalm-suppress DeprecatedMethod */
419419
$column->name($info['field']);
420-
$column->allowNull($info['null'] === 'YES');
421-
$column->primaryKey(str_contains($info['key'], 'PRI'));
420+
$column->notNull($info['null'] !== 'YES');
421+
$column->primaryKey($info['key'] === 'PRI');
422422
$column->autoIncrement(stripos($info['extra'], 'auto_increment') !== false);
423+
$column->unique($info['key'] === 'UNI');
423424
$column->comment($info['comment']);
424425
$column->dbType($dbType);
425426

0 commit comments

Comments
 (0)