File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
adminforth/dataConnectors Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,29 @@ class MysqlConnector extends AdminForthBaseConnector implements IAdminForthDataS
3939 [ AdminForthSortDirections . desc ] : 'DESC' ,
4040 } ;
4141
42+ async getAllTables ( ) : Promise < Array < string > > {
43+ const [ rows ] = await this . client . query (
44+ `
45+ SELECT table_name
46+ FROM information_schema.tables
47+ WHERE table_schema = DATABASE() AND table_type = 'BASE TABLE';
48+ `
49+ ) ;
50+ return rows . map ( ( row : any ) => row . TABLE_NAME ) ;
51+ }
52+
53+ async getAllColumnsInTable ( tableName : string ) : Promise < Array < string > > {
54+ const [ rows ] = await this . client . query (
55+ `
56+ SELECT column_name
57+ FROM information_schema.columns
58+ WHERE table_name = ? AND table_schema = DATABASE();
59+ ` ,
60+ [ tableName ]
61+ ) ;
62+ return rows . map ( ( row : any ) => row . COLUMN_NAME ) ;
63+ }
64+
4265 async discoverFields ( resource ) {
4366 const [ results ] = await this . client . execute ( "SHOW COLUMNS FROM " + resource . table ) ;
4467 const fieldTypes = { } ;
You can’t perform that action at this time.
0 commit comments