@@ -179,10 +179,9 @@ export abstract class BaseDriver implements DriverInterface {
179179 ) {
180180 ssl = sslOptions . reduce (
181181 ( agg , { name, envKey, canBeFile, validate } ) => {
182- if ( process . env [ envKey ] ) {
183- const value = process . env [ envKey ] ;
184-
185- if ( validate ( value ) ) {
182+ const value = process . env [ envKey ] ;
183+ if ( value ) {
184+ if ( validate && validate ( value ) ) {
186185 return {
187186 ...agg ,
188187 ...{ [ name ] : value }
@@ -282,16 +281,15 @@ export abstract class BaseDriver implements DriverInterface {
282281 return this . query ( query ) . then ( data => reduce ( this . informationColumnsSchemaReducer , { } , data ) ) ;
283282 }
284283
285- public async createSchemaIfNotExists ( schemaName : string ) : Promise < Array < unknown > > {
286- return this . query (
284+ public async createSchemaIfNotExists ( schemaName : string ) : Promise < void > {
285+ const schemas = await this . query (
287286 `SELECT schema_name FROM information_schema.schemata WHERE schema_name = ${ this . param ( 0 ) } ` ,
288287 [ schemaName ]
289- ) . then ( ( schemas ) => {
290- if ( schemas . length === 0 ) {
291- return this . query ( `CREATE SCHEMA IF NOT EXISTS ${ schemaName } ` ) ;
292- }
293- return null ;
294- } ) ;
288+ ) ;
289+
290+ if ( schemas . length === 0 ) {
291+ await this . query ( `CREATE SCHEMA IF NOT EXISTS ${ schemaName } ` ) ;
292+ }
295293 }
296294
297295 public getTablesQuery ( schemaName : string ) {
@@ -305,7 +303,7 @@ export abstract class BaseDriver implements DriverInterface {
305303 return this . query ( loadSql , params , options ) ;
306304 }
307305
308- public dropTable ( tableName : string , options ?: unknown ) : Promise < unknown > {
306+ public dropTable ( tableName : string , options ?: QueryOptions ) : Promise < unknown > {
309307 return this . query ( `DROP TABLE ${ tableName } ` , [ ] , options ) ;
310308 }
311309
0 commit comments