@@ -175,7 +175,7 @@ public function buildStructure()
175175 } else {
176176 $ data ['method ' ] = 'UNKNOWN: ' . $ type ;
177177 }
178-
178+
179179 $ data ['comment ' ] = trim (str_replace (["\r" , "\n" ], '' , $ comment ));
180180
181181 $ this ->structure [$ field ] = $ data ;
@@ -325,7 +325,7 @@ public function buildKeys()
325325 $ primaryColumn = reset ($ primary ['columns ' ]);
326326 $ field = $ this ->structure [$ primaryColumn ];
327327 // and that column is an "increments" field ...
328- if (stripos ($ field ['method ' ], ' increments ' ) !== false ) {
328+ if (isset ($ field ['args ' ][ ' autoIncrement ' ]) && $ field [ ' args ' ][ ' autoIncrement ' ] === ' true ' ) {
329329 // then don't build the primary key, since Laravel takes care of it
330330 unset($ this ->keys ['PRIMARY ' ]);
331331 }
@@ -473,21 +473,48 @@ protected function escapeColumnList($array)
473473 return implode (', ' , $ array );
474474 }
475475
476- protected function parseInt ( $ type , $ args , $ typeExtra , $ extra )
476+ protected function getAutoIncrementArgument ( $ extra )
477477 {
478- $ method = $ this ->integerMaps [$ type ];
478+ $ arguments = [
479+ 'autoIncrement ' => 'false ' ,
480+ 'unsigned ' => 'false '
481+ ];
482+
479483 if (strpos ($ extra , 'auto_increment ' ) !== false ) {
480- $ method = str_replace ('nteger ' , 'ncrements ' , $ method );
481- } elseif (strpos ($ typeExtra , 'unsigned ' ) !== false ) {
482- $ method = 'unsigned ' . ucfirst ($ method );
484+ $ arguments ['autoIncrement ' ] = 'true ' ;
485+ }
486+
487+ return $ arguments ;
488+ }
489+
490+ protected function getUnsignedArgument ($ typeExtra )
491+ {
492+ $ arguments = [
493+ 'unsigned ' => 'false '
494+ ];
495+
496+ if (strpos ($ typeExtra , 'unsigned ' ) !== false ) {
497+ $ arguments ['unsigned ' ] = 'true ' ;
483498 }
484499
485- return $ this ->defaultParse ($ method );
500+ return $ arguments ;
501+ }
502+
503+ protected function parseInt ($ type , $ args , $ typeExtra , $ extra )
504+ {
505+ $ method = $ this ->integerMaps [$ type ];
506+ $ args = array_merge (
507+ $ this ->getAutoIncrementArgument ($ extra ),
508+ $ this ->getUnsignedArgument ($ typeExtra )
509+ );
510+
511+ return $ this ->defaultParse ($ method , $ args );
486512 }
487513
488514 protected function parseBigint ($ type , $ args , $ typeExtra , $ extra )
489515 {
490516 return $ this ->parseInt ($ type , $ args , $ typeExtra , $ extra );
517+
491518 }
492519
493520 protected function parseMediumint ($ type , $ args , $ typeExtra , $ extra )
@@ -534,17 +561,26 @@ protected function parseDatetime($type, $args, $typeExtra, $extra)
534561
535562 protected function parseDecimal ($ type , $ args , $ typeExtra , $ extra )
536563 {
537- return $ this ->defaultParse ('decimal ' , $ args );
564+ return $ this ->defaultParse ('decimal ' , array_merge (
565+ $ args ,
566+ $ this ->getUnsignedArgument ($ typeExtra )
567+ ));
538568 }
539569
540570 protected function parseDouble ($ type , $ args , $ typeExtra , $ extra )
541571 {
542- return $ this ->defaultParse ('double ' , $ args );
572+ return $ this ->defaultParse ('double ' , array_merge (
573+ $ args ,
574+ $ this ->getUnsignedArgument ($ typeExtra )
575+ ));
543576 }
544577
545578 protected function parseFloat ($ type , $ args , $ typeExtra , $ extra )
546579 {
547- return $ this ->defaultParse ('float ' , $ args );
580+ return $ this ->defaultParse ('float ' , array_merge (
581+ $ args ,
582+ $ this ->getUnsignedArgument ($ typeExtra )
583+ ));
548584 }
549585
550586 protected function parseLongtext ($ type , $ args , $ typeExtra , $ extra )
0 commit comments