File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,14 @@ protected function generateColumnRules(stdClass $column): array
90
90
$ columnRules [] = "integer " ;
91
91
$ sign = ($ type ->contains ('unsigned ' )) ? 'unsigned ' : 'signed ' ;
92
92
$ intType = $ type ->before (' unsigned ' )->__toString ();
93
+
94
+ // prevent int(xx) for mysql
95
+ $ intType = preg_replace ("/\([^)]+\)/ " , "" , $ intType );
96
+
97
+ if (!array_key_exists ($ intType , self ::$ integerTypes )){
98
+ $ intType = "int " ;
99
+ }
100
+
93
101
$ columnRules [] = "min: " .self ::$ integerTypes [$ intType ][$ sign ][0 ];
94
102
$ columnRules [] = "max: " .self ::$ integerTypes [$ intType ][$ sign ][1 ];
95
103
@@ -109,7 +117,7 @@ protected function generateColumnRules(stdClass $column): array
109
117
$ columnRules [] = 'in: ' .implode (', ' , $ matches [1 ]);
110
118
111
119
break ;
112
- case $ type == 'year ' :
120
+ case $ type-> contains ( 'year ' ) :
113
121
$ columnRules [] = 'integer ' ;
114
122
$ columnRules [] = 'min:1901 ' ;
115
123
$ columnRules [] = 'max:2155 ' ;
You can’t perform that action at this time.
0 commit comments