migrating to typescript

This commit is contained in:
Anatoly 2018-07-19 02:21:06 +03:00
parent d8e85ef6b0
commit 2ad0921b33
3 changed files with 7 additions and 5 deletions

View file

@ -39,6 +39,11 @@ export default async function (conversion: Conversion): Promise<Conversion> {
const result: DBAccessQueryResult = await dbAccess.query('BinaryDataDecoder::decodeBinaryData', sql, DBVendors.PG, false, true);
if (result.error) {
// No need to continue if no 'bytea' or 'geometry' columns found.
return conversion;
}
const decodePromises: Promise<void>[] = result.data.rows.map(async (row: any) => {
const tableName: string = row.table_name;
const columnName: string = row.column_name;

View file

@ -144,8 +144,8 @@ export default class DBAccess {
// It must be requested from the connections pool.
client = vendor === DBVendors.PG ? await this.getPgClient() : await this.getMysqlClient();
} catch (error) {
// Client request failed.
// Must exit the function.
// An error occurred when tried to obtain a client from one of pools.
generateError(this._conversion, `\t--[${ caller }] ${ error }`, sql);
return processExitOnError ? process.exit() : { client: client, data: undefined, error: error };
}
}

View file

@ -22,7 +22,6 @@ import * as fs from 'fs';
import { Stats } from 'fs';
import * as path from 'path';
import log from './Logger';
import generateError from './ErrorGenerator';
import Conversion from './Conversion';
import * as migrationStateManager from './MigrationStateManager';
import DBAccess from './DBAccess';
@ -128,7 +127,6 @@ export default async function(conversion: Conversion): Promise<void> {
const showCreateViewResult: DBAccessQueryResult = await dbAccess.query(logTitle, sqlShowCreateView, DBVendors.MYSQL, false, false);
if (showCreateViewResult.error) {
generateError(conversion, `\t--[${ logTitle }] ${ showCreateViewResult.error }`, sqlShowCreateView);
return;
}
@ -136,7 +134,6 @@ export default async function(conversion: Conversion): Promise<void> {
const createPgViewResult: DBAccessQueryResult = await dbAccess.query(logTitle, sqlCreatePgView, DBVendors.PG, false, false);
if (createPgViewResult.error) {
generateError(conversion, `\t--[${ logTitle }] ${ createPgViewResult.error }`, sqlCreatePgView);
return logNotCreatedView(conversion, view, sqlCreatePgView);
}