Skip to content

Commit

Permalink
fix: year
Browse files Browse the repository at this point in the history
  • Loading branch information
giagara committed Jul 20, 2023
1 parent b709f40 commit 018f629
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Resolvers/SchemaRulesResolverMySql.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ protected function generateColumnRules(stdClass $column): array
$intType = $type->before(' unsigned')->__toString();

// prevent int(xx) for mysql
$intType = preg_replace("/\([^)]+\)/", "", $intType);

if(!array_key_exists($intType, self::$integerTypes)){
$intType = "int";
}
Expand All @@ -115,7 +117,7 @@ protected function generateColumnRules(stdClass $column): array
$columnRules[] = 'in:'.implode(',', $matches[1]);

break;
case $type == 'year':
case $type->contains('year'):
$columnRules[] = 'integer';
$columnRules[] = 'min:1901';
$columnRules[] = 'max:2155';
Expand Down

0 comments on commit 018f629

Please sign in to comment.