NMIG is an app, intended to make a process of migration from MySQL to PostgreSQL as easy and smooth as possible.
- Precise migration of the database structure - NMIG converts MySQL data types to corresponding PostgreSQL data types, creates constraints, indexes, primary and foreign keys exactly as they were before migration.
- Ability to rename tables and columns during migration.
- Ability to recover migration process if disaster took place without restarting from the beginning.
- Ability to migrate big databases fast - in order to migrate data NMIG utilizes PostgreSQL COPY protocol.
- Ease of monitoring - NMIG will provide detailed output about every step, it takes during the execution.
- Ease of configuration - all the parameters required for migration should be put in one single JSON document.
- Node.js 18.16.1 (the LTS version, upon Nmig's last major update) or higher
1. Create a new PostgreSQL database.
Sample: CREATE DATABASE my_postgresql_database;
If you are planning to migrate spatial data (geometry type columns), then PostGIS should be installed and enabled.
2. Download Nmig package and put it on the machine running your PostgreSQL (not mandatory, but preferably).
Sample: /path/to/nmig
3. Edit configuration file located at /path/to/nmig/config/config.json
with correct details.
- config.json contains brief description of each configuration parameter
- Make sure, that username, you use in your PostgreSQL connection details, defined as superuser (usually "postgres")
More info: http://www.postgresql.org/docs/current/static/app-createuser.html -
- As an option, you can move the entire
config
folder out of Nmig's directory and place it in any location - As an option, you can store the Nmig's logs in any location. All you need to do is to create the
nmig_logs
directory
- As an option, you can move the entire
4. Go to Nmig directory, install dependencies, compile and run the app
Sample:
$ cd /path/to/nmig
$ npm install
$ npm run build
$ npm start
Or, if you have moved
config
folder out from Nmig's directory:npm start -- --conf-dir='/path/to/nmig_config' --logs-dir='/path/to/nmig_logs'
5. If a disaster took place during migration (for what ever reason) - simply restart the process
$ npm start
Or, if you have moved config
folder out from Nmig's directory:
$ npm start -- --conf-dir='/path/to/nmig_config' --logs-dir='/path/to/nmig_logs'
NMIG will restart from the point it was stopped at.
6. At the end of migration check log files, if necessary.
Log files will be located under "logs_directory" folder in the root of the package.
Note: If you've created nmig_logs
folder outside the nmig's directory than "logs_directory" will reside in nmig_logs
.
Note: "logs_directory" will be created during script execution.
7. In case of any remarks, misunderstandings or errors during migration,
please feel free to email me
[email protected]
1. Create a new PostgreSQL database.
Sample: CREATE DATABASE nmig_test_db;
2. Download Nmig package.
Sample: /path/to/nmig
3. Edit configuration file located at /path/to/nmig/config/test_config.json
with correct details.
- test_config.json contains brief description of each configuration parameter
- Make sure, that username, you use in your PostgreSQL connection details, defined as superuser (usually "postgres")
More info: http://www.postgresql.org/docs/current/static/app-createuser.html -
- As an option, you can move the entire
config
folder out of Nmig's directory and place it in any location - As an option, you can store the Nmig's logs in any location. All you need to do is to create the
nmig_logs
directory
- As an option, you can move the entire
4. Go to nmig directory, install dependencies, compile and run tests
Sample:
$ cd /path/to/nmig
$ npm install
$ npm run build
$ npm test
Or, if you have moved
config
folder out from Nmig's directory:npm test -- --conf-dir='/path/to/nmig_config' --logs-dir='/path/to/nmig_logs'
5. At the end of migration check log files, if necessary.
Log files will be located under "logs_directory" folder in the root of the package.
Note: If you've created nmig_logs
folder outside the nmig's directory than "logs_directory" will reside in nmig_logs
.
Note: "logs_directory" will be created during script execution.
Current version is 6.1.1
NMIG is available under "GNU GENERAL PUBLIC LICENSE" (v. 3)
http://www.gnu.org/licenses/gpl.txt.