Skip to content

Commit 018f629

Browse files
committed
fix: year
1 parent b709f40 commit 018f629

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Resolvers/SchemaRulesResolverMySql.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ protected function generateColumnRules(stdClass $column): array
9292
$intType = $type->before(' unsigned')->__toString();
9393

9494
// prevent int(xx) for mysql
95+
$intType = preg_replace("/\([^)]+\)/", "", $intType);
96+
9597
if(!array_key_exists($intType, self::$integerTypes)){
9698
$intType = "int";
9799
}
@@ -115,7 +117,7 @@ protected function generateColumnRules(stdClass $column): array
115117
$columnRules[] = 'in:'.implode(',', $matches[1]);
116118

117119
break;
118-
case $type == 'year':
120+
case $type->contains('year'):
119121
$columnRules[] = 'integer';
120122
$columnRules[] = 'min:1901';
121123
$columnRules[] = 'max:2155';

0 commit comments

Comments
 (0)