add configuration option to change default delimiter, copyright notice

This commit is contained in:
AnatolyUss 2017-02-04 13:51:47 +02:00
parent 86d872ea83
commit d65b2a8034
41 changed files with 60 additions and 49 deletions

View file

@ -61,7 +61,7 @@ from MySQL to PostgreSQL as easy and smooth as possible.</p>
<a href="mailto:anatolyuss@gmail.com?subject=NMIG">anatolyuss@gmail.com</a></p>
<h3>VERSION</h3>
<p>Current version is 2.5.0<br />
<p>Current version is 2.6.0<br />
(major version . improvements . bug fixes)</p>

View file

@ -95,6 +95,13 @@
],
"migrate_only_data" : false,
"delimiter_description" : [
"Specifies the character that separates columns within each record.",
"This must be a single one-byte character.",
"The default is comma."
],
"delimiter" : ",",
"enable_extra_config_description" : [
"In order to enable the additional configuration options - set this parameter true."
],

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -41,7 +41,7 @@ module.exports = self => {
if (!self._mysql) {
self._sourceConString.connectionLimit = self._maxPoolSizeSource;
const pool = mysql.createPool(self._sourceConString);
if (pool) {
self._mysql = pool;
mysqlResolve();

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software= you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -93,4 +93,8 @@ module.exports = function Conversion(config) {
this._maxLoaderProcesses = this._config.max_loader_processes !== undefined && isIntNumeric(this._config.max_loader_processes)
? +this._config.max_loader_processes
: 1;
this._delimiter = this._config.delimiter !== undefined && this._config.delimiter.length === 1
? this._config.delimiter
: ',';
};

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -255,7 +255,7 @@ const populateTableWorker = (self, tableName, strSelectFieldList, offset, rowsIn
generateError(self, '\t--[populateTableWorker] Cannot connect to PostgreSQL server...\n' + error, sql);
deleteCsv(csvAddr, fd).then(() => resolvePopulateTableWorker());
} else {
const sqlCopy = 'COPY "' + self._schema + '"."' + tableName + '" FROM STDIN DELIMITER \'' + ',\'' + ' CSV;';
const sqlCopy = 'COPY "' + self._schema + '"."' + tableName + '" FROM STDIN DELIMITER \'' + self._delimiter + '\' CSV;';
const copyStream = client.query(copyFrom(sqlCopy));
const readStream = fs.createReadStream(csvAddr, { encoding: self._encoding });

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -40,7 +40,7 @@ module.exports = (self, tableName) => {
log(self, '\t--[processEnum] Defines "ENUMs" for table "' + self._schema + '"."' + tableName + '"', self._dicTables[tableName].tableLogPath);
const processEnumPromises = [];
const originalTableName = extraConfigProcessor.getTableName(self, tableName, true);
for (let i = 0; i < self._dicTables[tableName].arrTableColumns.length; ++i) {
if (self._dicTables[tableName].arrTableColumns[i].Type.indexOf('(') !== -1) {
const arrType = self._dicTables[tableName].arrTableColumns[i].Type.split('(');

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software= you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -42,7 +42,7 @@ const boot = require('./BootProcessor');
*/
module.exports = config => {
const self = new Conversion(config);
boot(self).then(() => {
return readDataTypesMap(self);
}).then(

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -40,7 +40,7 @@ module.exports = (self, tableName) => {
log(self, '\t--[processNull] Defines "NOT NULLs" for table: "' + self._schema + '"."' + tableName + '"', self._dicTables[tableName].tableLogPath);
const processNullPromises = [];
const originalTableName = extraConfigProcessor.getTableName(self, tableName, true);
for (let i = 0; i < self._dicTables[tableName].arrTableColumns.length; ++i) {
if (self._dicTables[tableName].arrTableColumns[i].Null.toLowerCase() === 'no') {
processNullPromises.push(

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -104,7 +104,7 @@ module.exports.createSequence = (self, tableName) => {
return new Promise(resolve => {
const createSequencePromises = [];
const originalTableName = extraConfigProcessor.getTableName(self, tableName, true);
for (let i = 0; i < self._dicTables[tableName].arrTableColumns.length; ++i) {
if (self._dicTables[tableName].arrTableColumns[i].Extra === 'auto_increment') {
createSequencePromises.push(

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -127,7 +127,7 @@ module.exports.createTable = (self, tableName) => {
}
sql += '"' + self._schema + '_' + originalTableName + '_data_chunk_id_temp" BIGINT);';
client.query(sql, err => {
done();

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -36,7 +36,7 @@ module.exports = self => {
return connect(self).then(() => {
return new Promise(resolve => {
const vacuumPromises = [];
for (let i = 0; i < self._tablesToMigrate.length; ++i) {
if (self._noVacuum.indexOf(extraConfigProcessor.getTableName(self, self._tablesToMigrate[i], true)) === -1) {
const msg = '\t--[runVacuumFullAndAnalyze] Running "VACUUM FULL and ANALYZE" query for table "'

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -122,7 +122,7 @@ module.exports = self => {
return migrationStateManager.get(self, 'views_loaded').then(hasViewsLoaded => {
return new Promise(resolve => {
const createViewPromises = [];
if (!hasViewsLoaded) {
for (let i = 0; i < self._viewsToMigrate.length; ++i) {
createViewPromises.push(

View file

@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <anatolyuss@gmail.com>
* Copyright (C) 2016 - present, Anatoly Khaytovich <anatolyuss@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View file

@ -1,6 +1,6 @@
{
"name": "nmig",
"version": "2.5.0",
"version": "2.6.0",
"description": "The database migration app",
"author": "Anatoly Khaytovich<anatolyuss@gmail.com>",
"dependencies": {