Skip to content

Commit

Permalink
Update according changes in ColumnSchemaInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Sep 20, 2024
1 parent 30513b4 commit 295fa65
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 63 deletions.
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 295fa65

Please sign in to comment.