Giter VIP home page Giter VIP logo

frommysqltopostgresql's Introduction

FromMySqlToPostgreSql - the database migration tool.

WHAT IS IT ALL ABOUT?

FromMySqlToPostgreSql is a tool, intended to make a process of migration from MySql to PostgreSql as easy and smooth as possible.

Important update!
Recently I've developed NMIG, a database migration app, written in Node.js, and highly inspired by FromMySqlToPostgreSql.
NMIG has important functional enhancements.
Due to Node.js asynchronous nature, NMIG executes a part of its tasks in parallel, what makes it up to 3 times faster than FromMySqlToPostgreSql. Visit https://github.com/AnatolyUss/nmig.
However, if you're not into Node.js, you can still use old and proven FromMySqlToPostgreSql.

KEY FEATURES

  • Ease of use - the only thing needed to run this script is the PHP(CLI) interpreter.
  • Accuracy of migration the database structure - FromMySqlToPostgreSql converts MySql data types to corresponding PostgreSql data types, creates constraints, indexes, primary and foreign keys exactly as they were before migration.
  • Speed of data transfer - in order to migrate data fast
    FromMySqlToPostgreSql uses PostgreSQL COPY protocol.
  • Ease of monitoring - FromMySqlToPostgreSql 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 file, which can be in either "xml" or "json" format.
  • Ability to transfer only a data (in case of an existing database).
  • Ability to transfer list of tables.

SYSTEM REQUIREMENTS

  • PHP (CLI) 5.4 or above
  • PDO_MYSQL should be installed and enabled
  • PDO_PGSQL should be installed and enabled
  • mbstring should be installed and enabled
  • register_argc_argv should be enabled (check php.ini).
  • postgis should be installed and enabled to migrate spatial data (geometry type columns).

USAGE

1. Create a new database.
    Sample:CREATE DATABASE my_postgresql_database;

2. Download FromMySqlToPostgreSql package and put it on the machine running your PostgreSql.
    Sample: /path/to/FromMySqlToPostgreSql

3. Create configuration file in either "xml" or "json" format and put it on the machine running your PostgreSql.
    Sample: /path/to/FromMySqlToPostgreSql/config.json   or  /path/to/FromMySqlToPostgreSql/config.xml

Remarks:

  • sample_config.json and sample_config.xml are examples of configuration file, so you can edit one of them and use for migration.
  • Brief description of each configuration parameter will be found at sample_config.json and sample_config.xml
  • Make sure, that username, you use in your PostgreSQL connection string, defined as superuser (usually "postgres")
    More info: http://www.postgresql.org/docs/current/static/app-createuser.html

4. Run the script from a terminal.
    Sample: php /path/to/FromMySqlToPostgreSql/index.php /path/to/FromMySqlToPostgreSql/config[.xml | .json]

5. At the end of migration check log files, if necessary.
    Log files will be located in "logs_directory" folder in the root of the package.
    Note: "logs_directory" will be created during script execution.

6. In case of any remarks, misunderstandings or errors during migration,
    please feel free to email me [email protected]

VERSION

Current version is 1.4.2
(major version . improvements . bug fixes)

TESTING

The tests/ folder contains SQL files that exercise the migration tool to ensure it can process different types of input structures correctly. To use these files you must setup a mysql server with them. An example might be mysql < tests/foreign_key.sql. You can then follow the use the USAGE section to create a migration script it runs without error. If you wish to add further tests to verify issues that are fixed, just add another SQL file and future developers will be able to confirm that changes don't cause any regressions.

PERFORMANCE RESULTS

Tested using MariaDB 10 and PostgreSql (9.6).
The entire process of migration 33 GB database (90 tables, approximately 72 million rows),
which includes data types mapping, creation of tables, constraints, indexes,
PKs, FKs, migration of data, garbage-collection and analyzing the newly created
PostgreSql database took 54 minutes.

LICENSE

FromMySqlToPostgreSql is available under "GNU GENERAL PUBLIC LICENSE" (v. 3)
http://www.gnu.org/licenses/gpl.txt.

REMARKS

Errors/Exceptions are not passed silently.
Any error will be immediately written into the error log file.

ACKNOWLEDGEMENTS

Big thanks to all contributors for their valuable remarks!

frommysqltopostgresql's People

Contributors

agbodike avatar anatolyuss avatar chewi avatar gucarletto avatar inem88 avatar jakob avatar jozes avatar matteoquintiliani avatar mr-russ avatar thierrydaguin avatar vagrus avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.