@@ -30,22 +30,14 @@ class DatabaseTableCommand extends Command
3030 */
3131 protected $ database ;
3232
33- /**
34- * @var R
35- */
36- protected $ redBean ;
37-
3833 /**
3934 * DatabaseTableCommand constructor.
4035 *
41- * @param R $redBean
4236 * @param Connection $database
4337 */
4438 public function __construct (
45- R $ redBean ,
4639 Connection $ database
4740 ) {
48- $ this ->redBean = $ redBean ;
4941 $ this ->database = $ database ;
5042 parent ::__construct ();
5143 }
@@ -82,30 +74,30 @@ protected function execute(InputInterface $input, OutputInterface $output)
8274 {
8375 $ database = $ input ->getOption ('database ' );
8476 $ table = $ input ->getArgument ('table ' );
85-
8677 $ databaseConnection = $ this ->resolveConnection ($ database );
87-
8878 if ($ table ) {
89- $ this ->redBean = $ this ->getRedBeanConnection ($ database );
90- if (empty ($ this ->redBean )) {
79+ $ result = $ this ->database
80+ ->query ('DESCRIBE ' . $ table .'; ' )
81+ ->fetchAll ();
82+ if (!$ result ) {
9183 throw new \Exception (
9284 sprintf (
9385 $ this ->trans ('commands.debug.database.table.messages.no-connection ' ),
9486 $ database
9587 )
9688 );
9789 }
98- $ tableInfo = $ this ->redBean ->inspect ($ table );
9990
10091 $ tableHeader = [
10192 $ this ->trans ('commands.debug.database.table.messages.column ' ),
10293 $ this ->trans ('commands.debug.database.table.messages.type ' )
10394 ];
10495 $ tableRows = [];
105- foreach ($ tableInfo as $ column => $ type ) {
96+ foreach ($ result as $ record ) {
97+ $ column = json_decode (json_encode ($ record ), true );
10698 $ tableRows [] = [
107- 'column ' => $ column ,
108- 'type ' => $ type
99+ 'column ' => $ column[ ' Field ' ] ,
100+ 'type ' => $ column [ ' Type ' ],
109101 ];
110102 }
111103
0 commit comments