Skip to content

Commit

Permalink
add configuration option to change default delimiter, copyright notice
Browse files Browse the repository at this point in the history
  • Loading branch information
AnatolyUss committed Feb 4, 2017
1 parent 86d872e commit d65b2a8
Show file tree
Hide file tree
Showing 41 changed files with 60 additions and 49 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ from MySQL to PostgreSQL as easy and smooth as possible.</p>
<a href="mailto:[email protected]?subject=NMIG">[email protected]</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>


Expand Down
7 changes: 7 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
],
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/BootProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/CleanupProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/ColumnsDataArranger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/CommentsProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
4 changes: 2 additions & 2 deletions migration/fmtp/Connector.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/ConsistencyEnforcer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/ConstraintsProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
6 changes: 5 additions & 1 deletion migration/fmtp/Conversion.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down Expand Up @@ -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
: ',';
};
2 changes: 1 addition & 1 deletion migration/fmtp/DataChunksProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
4 changes: 2 additions & 2 deletions migration/fmtp/DataLoader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down Expand Up @@ -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 });

Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/DataPipeManager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/DataPoolManager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/DataTypesMapReader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/DefaultProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/DirectoriesManager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
4 changes: 2 additions & 2 deletions migration/fmtp/EnumProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down Expand Up @@ -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('(');
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/ErrorGenerator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/ExtraConfigProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/ForeignKeyProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/IndexAndKeyProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/IntegerValidator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/Logger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
4 changes: 2 additions & 2 deletions migration/fmtp/Main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down Expand Up @@ -42,7 +42,7 @@ const boot = require('./BootProcessor');
*/
module.exports = config => {
const self = new Conversion(config);

boot(self).then(() => {
return readDataTypesMap(self);
}).then(
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/MessageToDataLoader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/MessageToMaster.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/MigrationStateManager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/NewBuffer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
4 changes: 2 additions & 2 deletions migration/fmtp/NullProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/OldBuffer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/ReportGenerator.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/SchemaProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
4 changes: 2 additions & 2 deletions migration/fmtp/SequencesProcessor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/StructureLoader.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
2 changes: 1 addition & 1 deletion migration/fmtp/Table.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is a part of "NMIG" - the database migration tool.
*
* Copyright (C) 2016 - 2017 Anatoly Khaytovich <[email protected]>
* Copyright (C) 2016 - present, Anatoly Khaytovich <[email protected]>
*
* 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
Expand Down
Loading

0 comments on commit d65b2a8

Please sign in to comment.