Skip to content

Commit 6ad0c26

Browse files
committed
Merge branch 'release/v5.4.0'
2 parents ff3202d + 5f0c5eb commit 6ad0c26

30 files changed

+173
-173
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Or, if you have moved <code>config</code> folder out from Nmig's directory:<br /
109109
<br /><b>Note:</b> "logs_directory" will be created during script execution.</p>
110110

111111
<h3>VERSION</h3>
112-
<p>Current version is 5.3.1<br />
112+
<p>Current version is 5.4.0<br />
113113

114114
<h3>LICENSE</h3>
115115
<p>NMIG is available under "GNU GENERAL PUBLIC LICENSE" (v. 3) <br />

package-lock.json

Lines changed: 13 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nmig",
3-
"version": "5.3.1",
3+
"version": "5.4.0",
44
"description": "The database migration app",
55
"author": "Anatoly Khaytovich<anatolyuss@gmail.com>",
66
"license": "GPL-3.0",
@@ -14,16 +14,16 @@
1414
"dependencies": {
1515
"json2csv": "^5.0.1",
1616
"mysql": "^2.18.1",
17-
"pg": "^8.3.0",
18-
"pg-copy-streams": "^2.2.2"
17+
"pg": "^8.3.3",
18+
"pg-copy-streams": "^2.2.2",
19+
"@types/mysql": "^2.15.15",
20+
"@types/node": "^14.10.1",
21+
"@types/pg": "^7.14.4"
1922
},
2023
"devDependencies": {
21-
"@types/mysql": "^2.15.15",
22-
"@types/node": "^14.0.27",
23-
"@types/pg": "^7.14.4",
2424
"@types/tape": "^4.13.0",
2525
"tape": "^5.0.1",
26-
"typescript": "^3.9.7"
26+
"typescript": "^4.0.2"
2727
},
2828
"scripts": {
2929
"build": "tsc",

src/BinaryDataDecoder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import { PoolClient } from 'pg';
2929
/**
3030
* Decodes binary data from from textual representation in string.
3131
*/
32-
export default async function (conversion: Conversion): Promise<Conversion> {
32+
export default async (conversion: Conversion): Promise<Conversion> => {
3333
const logTitle: string = 'BinaryDataDecoder::decodeBinaryData';
3434
log(conversion, `\t--[${ logTitle }] Decodes binary data from textual representation in string.`);
3535

@@ -67,4 +67,4 @@ export default async function (conversion: Conversion): Promise<Conversion> {
6767

6868
await Promise.all(decodePromises);
6969
return conversion;
70-
}
70+
};

src/BootProcessor.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { getStateLogsTableName } from './MigrationStateManager';
3030
/**
3131
* Checks correctness of connection details of both MySQL and PostgreSQL.
3232
*/
33-
export async function checkConnection(conversion: Conversion): Promise<string> {
33+
export const checkConnection = async (conversion: Conversion): Promise<string> => {
3434
let resultMessage: string = '';
3535
const params: IDBAccessQueryParams = {
3636
conversion: conversion,
@@ -48,12 +48,12 @@ export async function checkConnection(conversion: Conversion): Promise<string> {
4848
const pgResult: DBAccessQueryResult = await DBAccess.query(params);
4949
resultMessage += pgResult.error ? `\tPostgreSQL connection error: ${ JSON.stringify(pgResult.error) }` : '';
5050
return resultMessage;
51-
}
51+
};
5252

5353
/**
5454
* Returns Nmig's logo.
5555
*/
56-
export function getLogo(): string {
56+
export const getLogo = (): string => {
5757
return '\n\t/\\_ |\\ /\\/\\ /\\___'
5858
+ '\n\t| \\ | |\\ | | | __'
5959
+ '\n\t| |\\\\| || | | | \\_ \\'
@@ -62,12 +62,12 @@ export function getLogo(): string {
6262
+ '\n\n\tNMIG - the database migration tool'
6363
+ '\n\tCopyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>\n\n'
6464
+ '\t--[boot] Configuration has been just loaded.';
65-
}
65+
};
6666

6767
/**
6868
* Boots the migration.
6969
*/
70-
export function boot(conversion: Conversion): Promise<Conversion> {
70+
export const boot = (conversion: Conversion): Promise<Conversion> => {
7171
return new Promise<Conversion>(async resolve => {
7272
const connectionErrorMessage = await checkConnection(conversion);
7373
const logo: string = getLogo();
@@ -97,7 +97,7 @@ export function boot(conversion: Conversion): Promise<Conversion> {
9797

9898
console.log(logo + message);
9999

100-
const _getUserInput = (input: string) => {
100+
const _getUserInput = (input: string): void => {
101101
const trimedInput: string = input.trim();
102102

103103
if (trimedInput === 'n' || trimedInput === 'N') {
@@ -122,7 +122,7 @@ export function boot(conversion: Conversion): Promise<Conversion> {
122122
.setEncoding(conversion._encoding)
123123
.on('data', _getUserInput);
124124
});
125-
}
125+
};
126126

127127
/**
128128
* Parses CLI input arguments, if given.
@@ -132,9 +132,9 @@ export function boot(conversion: Conversion): Promise<Conversion> {
132132
* npm start -- --conf-dir='C:\Users\anatolyuss\Documents\projects\nmig_config' --logs-dir='C:\Users\anatolyuss\Documents\projects\nmig_logs'
133133
* npm test -- --conf-dir='C:\Users\anatolyuss\Documents\projects\nmig_config' --logs-dir='C:\Users\anatolyuss\Documents\projects\nmig_logs'
134134
*/
135-
export function getConfAndLogsPaths(): IConfAndLogsPaths {
135+
export const getConfAndLogsPaths = (): IConfAndLogsPaths => {
136136
const baseDir: string = path.join(__dirname, '..', '..');
137-
const _parseInputArguments = (paramName: string) => {
137+
const _parseInputArguments = (paramName: string): string | undefined => {
138138
const _path: string | undefined = process.argv.find((arg: string) => arg.startsWith(paramName));
139139
return _path ? _path.split('=')[1] : undefined;
140140
};
@@ -143,4 +143,4 @@ export function getConfAndLogsPaths(): IConfAndLogsPaths {
143143
confPath: _parseInputArguments('--conf-dir') || path.join(baseDir, 'config'),
144144
logsPath: _parseInputArguments('--logs-dir') || baseDir
145145
};
146-
}
146+
};

src/CommentsProcessor.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ import IDBAccessQueryParams from './IDBAccessQueryParams';
2929
/**
3030
* Escapes quotes inside given string.
3131
*/
32-
function escapeQuotes(str: string): string {
32+
const escapeQuotes = (str: string): string => {
3333
const regexp: RegExp = new RegExp(`'`, 'g');
3434
return str.replace(regexp, `''`);
35-
}
35+
};
3636

3737
/**
3838
* Creates table comments.
3939
*/
40-
async function processTableComments(conversion: Conversion, tableName: string): Promise<void> {
40+
const processTableComments = async (conversion: Conversion, tableName: string): Promise<void> => {
4141
const logTitle: string = 'CommentsProcessor::processTableComments';
4242
const sqlSelectComment: string = `SELECT table_comment AS table_comment FROM information_schema.tables
4343
WHERE table_schema = '${ conversion._mySqlDbName }'
@@ -69,12 +69,12 @@ async function processTableComments(conversion: Conversion, tableName: string):
6969

7070
const successMsg: string = `\t--[${ logTitle }] Successfully set comment for table "${ conversion._schema }"."${ tableName }"`;
7171
log(conversion, successMsg, conversion._dicTables[tableName].tableLogPath);
72-
}
72+
};
7373

7474
/**
7575
* Creates columns comments.
7676
*/
77-
async function processColumnsComments(conversion: Conversion, tableName: string): Promise<void> {
77+
const processColumnsComments = async (conversion: Conversion, tableName: string): Promise<void> => {
7878
const logTitle: string = 'CommentsProcessor::processColumnsComments';
7979
const originalTableName: string = extraConfigProcessor.getTableName(conversion, tableName, true);
8080

@@ -105,17 +105,17 @@ async function processColumnsComments(conversion: Conversion, tableName: string)
105105
});
106106

107107
await Promise.all(commentPromises);
108-
}
108+
};
109109

110110
/**
111111
* Migrates comments.
112112
*/
113-
export default async function(conversion: Conversion, tableName: string): Promise<void> {
113+
export default async (conversion: Conversion, tableName: string): Promise<void> => {
114114
const logTitle: string = 'CommentsProcessor::default';
115115
const msg: string = `\t--[${ logTitle }] Creates comments for table "${ conversion._schema }"."${ tableName }"...`;
116116
log(conversion, msg, conversion._dicTables[tableName].tableLogPath);
117117
await Promise.all([
118118
processTableComments(conversion, tableName),
119119
processColumnsComments(conversion, tableName)
120120
]);
121-
}
121+
};

src/ConsistencyEnforcer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { getDataPoolTableName } from './DataPoolManager';
3131
* In case of normal execution - it is a good practice.
3232
* In case of rerunning Nmig after unexpected failure - it is absolutely mandatory.
3333
*/
34-
export async function dataTransferred(conversion: Conversion, dataPoolId: number): Promise<boolean> {
34+
export const dataTransferred = async (conversion: Conversion, dataPoolId: number): Promise<boolean> => {
3535
const dataPoolTable: string = getDataPoolTableName(conversion);
3636
const sqlGetMetadata: string = `SELECT metadata AS metadata FROM ${ dataPoolTable } WHERE id = ${ dataPoolId };`;
3737
const params: IDBAccessQueryParams = {
@@ -53,4 +53,4 @@ export async function dataTransferred(conversion: Conversion, dataPoolId: number
5353

5454
const probe: DBAccessQueryResult = await DBAccess.query(params);
5555
return probe.data.rows.length !== 0;
56-
}
56+
};

src/ConstraintsProcessor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import Conversion from './Conversion';
3232
/**
3333
* Continues migration process after data loading.
3434
*/
35-
export async function processConstraints(conversion: Conversion): Promise<Conversion> {
35+
export const processConstraints = async (conversion: Conversion): Promise<Conversion> => {
3636
const isTableConstraintsLoaded: boolean = await migrationStateManager.get(conversion, 'per_table_constraints_loaded');
3737
const migrateOnlyData: boolean = conversion.shouldMigrateOnlyData();
3838

@@ -55,16 +55,16 @@ export async function processConstraints(conversion: Conversion): Promise<Conver
5555
}
5656

5757
return conversion;
58-
}
58+
};
5959

6060
/**
6161
* Processes given table's constraints.
6262
*/
63-
export async function processConstraintsPerTable(
63+
export const processConstraintsPerTable = async (
6464
conversion: Conversion,
6565
tableName: string,
6666
migrateOnlyData: boolean
67-
): Promise<void> {
67+
): Promise<void> => {
6868
if (migrateOnlyData) {
6969
return sequencesProcessor.setSequenceValue(conversion, tableName);
7070
}
@@ -75,4 +75,4 @@ export async function processConstraintsPerTable(
7575
await sequencesProcessor.createSequence(conversion, tableName);
7676
await processIndexAndKey(conversion, tableName);
7777
await processComments(conversion, tableName);
78-
}
78+
};

src/DataChunksProcessor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ export default async (conversion: Conversion, tableName: string, haveDataChunksP
6565
params.bindings = [metadata];
6666

6767
await DBAccess.query(params);
68-
}
68+
};

0 commit comments

Comments
 (0)