File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,8 @@ public function getData()
45
45
: data_get ($ foreignColumn , 'foreign_table ' );
46
46
$ columnType = 'FK -> ' .$ foreignTable ;
47
47
}
48
- $ length = is_object ($ column ) && method_exists ($ column , 'getLength ' ) ? $ column ->getLength () : count ($ columns );
48
+
49
+ $ length = is_object ($ column ) && method_exists ($ column , 'getLength ' ) ? $ column ->getLength () : $ this ->extractNumber (data_get ($ column , 'type ' ));
49
50
50
51
$ details ['column ' ] = $ columnName ;
51
52
$ details ['type ' ] = $ columnType .$ this ->determineUnsigned ($ column );
@@ -67,6 +68,13 @@ public function getData()
67
68
return $ this ->collections ;
68
69
}
69
70
71
+ private function extractNumber (string $ type ): ?int
72
+ {
73
+ preg_match ('/\d+/ ' , $ type , $ matches );
74
+
75
+ return ! empty ($ matches ) ? (int ) $ matches [0 ] : null ;
76
+ }
77
+
70
78
private function determineUnsigned ($ column )
71
79
{
72
80
if (is_object ($ column ) && method_exists ($ column , 'getUnsigned ' )) {
You can’t perform that action at this time.
0 commit comments