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/**
@@ -409,28 +410,28 @@ export abstract class BaseDriver implements DriverInterface {
409410 return false ;
410411 }
411412
412- protected informationColumnsSchemaReducer ( result : any , i : any ) {
413+ protected informationColumnsSchemaReducer ( result : any , i : any ) : DatabaseStructure {
413414 let schema = ( result [ i . table_schema ] || { } ) ;
414- const tables = ( schema [ i . table_name ] || [ ] ) ;
415+ const columns = ( schema [ i . table_name ] || [ ] ) ;
415416
416- tables . push ( {
417+ columns . push ( {
417418 name : i . column_name ,
418419 type : i . data_type ,
419420 attributes : i . key_type ? [ 'primaryKey' ] : [ ]
420421 } ) ;
421422
422- tables . sort ( ) ;
423- schema [ i . table_name ] = tables ;
423+ columns . sort ( ) ;
424+ schema [ i . table_name ] = columns ;
424425 schema = sortByKeys ( schema ) ;
425426 result [ i . table_schema ] = schema ;
426427
427428 return sortByKeys ( result ) ;
428429 }
429430
430- public tablesSchema ( ) : Promise < any > {
431+ public tablesSchema ( ) : Promise < DatabaseStructure > {
431432 const query = this . informationSchemaQuery ( ) ;
432433
433- return this . query ( query , [ ] ) . then ( data => data . reduce ( this . informationColumnsSchemaReducer , { } ) ) ;
434+ return this . query ( query , [ ] ) . then ( data => data . reduce < DatabaseStructure > ( this . informationColumnsSchemaReducer , { } ) ) ;
434435 }
435436
436437 // 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