File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
packages/cubejs-base-driver/src Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ import {
5252 TableMemoryData ,
5353 PrimaryKeysQueryResult ,
5454 ForeignKeysQueryResult ,
55+ DatabaseStructure ,
5556} from './driver.interface' ;
5657
5758/**
@@ -401,28 +402,28 @@ export abstract class BaseDriver implements DriverInterface {
401402 return false ;
402403 }
403404
404- protected informationColumnsSchemaReducer ( result : any , i : any ) {
405+ protected informationColumnsSchemaReducer ( result : any , i : any ) : DatabaseStructure {
405406 let schema = ( result [ i . table_schema ] || { } ) ;
406- const tables = ( schema [ i . table_name ] || [ ] ) ;
407+ const columns = ( schema [ i . table_name ] || [ ] ) ;
407408
408- tables . push ( {
409+ columns . push ( {
409410 name : i . column_name ,
410411 type : i . data_type ,
411412 attributes : i . key_type ? [ 'primaryKey' ] : [ ]
412413 } ) ;
413414
414- tables . sort ( ) ;
415- schema [ i . table_name ] = tables ;
415+ columns . sort ( ) ;
416+ schema [ i . table_name ] = columns ;
416417 schema = sortByKeys ( schema ) ;
417418 result [ i . table_schema ] = schema ;
418419
419420 return sortByKeys ( result ) ;
420421 }
421422
422- public tablesSchema ( ) : Promise < any > {
423+ public tablesSchema ( ) : Promise < DatabaseStructure > {
423424 const query = this . informationSchemaQuery ( ) ;
424425
425- return this . query ( query , [ ] ) . then ( data => data . reduce ( this . informationColumnsSchemaReducer , { } ) ) ;
426+ return this . query ( query , [ ] ) . then ( data => data . reduce < DatabaseStructure > ( this . informationColumnsSchemaReducer , { } ) ) ;
426427 }
427428
428429 // Extended version of tablesSchema containing primary and foreign keys
Original file line number Diff line number Diff line change 22export type GenericDataBaseType = string ;
33
44export interface TableColumn {
5- // eslint-disable-next-line camelcase
65 name : string ;
7- // eslint-disable-next-line camelcase
86 type : GenericDataBaseType ;
97 attributes ?: string [ ]
108}
You can’t perform that action at this time.
0 commit comments