@@ -39,32 +39,38 @@ public function handle(ConnectionResolverInterface $connections)
3939 {
4040 $ connection = $ connections ->connection ($ this ->input ->getOption ('database ' ));
4141 $ schema = $ connection ->getSchemaBuilder ();
42- $ tables = $ schema ->getTables ();
42+ $ tables = collect ($ schema ->getTables ())
43+ ->keyBy (fn ($ table ) => $ table ['schema ' ] ? $ table ['schema ' ].'. ' .$ table ['name ' ] : $ table ['name ' ])
44+ ->all ();
4345
4446 $ tableName = $ this ->argument ('table ' ) ?: select (
4547 'Which table would you like to inspect? ' ,
46- array_column ($ tables, ' name ' )
48+ array_keys ($ tables )
4749 );
4850
49- $ table = Arr::first ($ tables , fn ($ table ) => $ table ['name ' ] === $ tableName );
51+ $ table = $ tables [ $ tableName ] ?? Arr::first ($ tables , fn ($ table ) => $ table ['name ' ] === $ tableName );
5052
5153 if (! $ table ) {
5254 $ this ->components ->warn ("Table [ {$ tableName }] doesn't exist. " );
5355
5456 return 1 ;
5557 }
5658
57- $ tableName = $ this ->withoutTablePrefix ($ connection , $ table ['name ' ]);
59+ $ tableName = ( $ table [ ' schema ' ] ? $ table [ ' schema ' ]. ' . ' : '' ). $ this ->withoutTablePrefix ($ connection , $ table ['name ' ]);
5860
5961 $ columns = $ this ->columns ($ schema , $ tableName );
6062 $ indexes = $ this ->indexes ($ schema , $ tableName );
6163 $ foreignKeys = $ this ->foreignKeys ($ schema , $ tableName );
6264
6365 $ data = [
6466 'table ' => [
67+ 'schema ' => $ table ['schema ' ],
6568 'name ' => $ table ['name ' ],
6669 'columns ' => count ($ columns ),
6770 'size ' => $ table ['size ' ],
71+ 'comment ' => $ table ['comment ' ],
72+ 'collation ' => $ table ['collation ' ],
73+ 'engine ' => $ table ['engine ' ],
6874 ],
6975 'columns ' => $ columns ,
7076 'indexes ' => $ indexes ,
@@ -103,6 +109,7 @@ protected function getAttributesForColumn($column)
103109 {
104110 return collect ([
105111 $ column ['type_name ' ],
112+ $ column ['generation ' ] ? $ column ['generation ' ]['type ' ] : null ,
106113 $ column ['auto_increment ' ] ? 'autoincrement ' : null ,
107114 $ column ['nullable ' ] ? 'nullable ' : null ,
108115 $ column ['collation ' ],
@@ -197,11 +204,19 @@ protected function displayForCli(array $data)
197204
198205 $ this ->newLine ();
199206
200- $ this ->components ->twoColumnDetail ('<fg=green;options=bold> ' .$ table ['name ' ].'</> ' );
207+ $ this ->components ->twoColumnDetail ('<fg=green;options=bold> ' .( $ table ['schema ' ] ? $ table [ ' schema ' ]. ' . ' . $ table [ ' name ' ] : $ table [ ' name ' ]) .'</> ' , $ table [ ' comment ' ] ? ' <fg=gray> ' . $ table [ ' comment ' ]. ' </> ' : null );
201208 $ this ->components ->twoColumnDetail ('Columns ' , $ table ['columns ' ]);
202209
203- if ($ size = $ table ['size ' ]) {
204- $ this ->components ->twoColumnDetail ('Size ' , Number::fileSize ($ size , 2 ));
210+ if (! is_null ($ table ['size ' ])) {
211+ $ this ->components ->twoColumnDetail ('Size ' , Number::fileSize ($ table ['size ' ], 2 ));
212+ }
213+
214+ if ($ table ['engine ' ]) {
215+ $ this ->components ->twoColumnDetail ('Engine ' , $ table ['engine ' ]);
216+ }
217+
218+ if ($ table ['collation ' ]) {
219+ $ this ->components ->twoColumnDetail ('Collation ' , $ table ['collation ' ]);
205220 }
206221
207222 $ this ->newLine ();
0 commit comments