8000 GitHub - cadmax/migrate-mysql-postgres
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cadmax/migrate-mysql-postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySQL to PostgreSQL Migration Script - README

Overview

This Node.js script facilitates data migration from a MySQL database to a PostgreSQL database. It automates creating tables, indexes, foreign keys, and data insertion while maintaining data integrity.

Prerequisites

  • Node.js installed
  • MySQL and PostgreSQL servers running
  • mysql2 and pg NPM packages installed

Configuration

Set up your database connection details at the beginning of the script:

// MySQL configuration
const mysqlConfig = {
  host: 'localhost',
  user: 'root',
  password: 'root',
  database: 'users',
  port: 3306
};

// PostgreSQL configuration
const postgresConfig = {
  host: 'localhost',
  user: 'postgres',
  password: 'postgres',
  database: 'users',
  port: 5432
};

Features

  • Converts MySQL data types to PostgreSQL-compatible types.
  • Creates tables, primary keys, indexes, and foreign keys in PostgreSQL.
  • Migrates data with null value handling and type conversion.
  • Detailed migration process logging.

How to Use

  1. Adjust the connection settings for your databases.
  2. Run npm install && npm run start
  3. Monitor the process as the script migrates each table.

Additional Information

  • Supports auto-increment fields, enumerations, and JSON fields.
  • SSL configuration for PostgreSQL is available but commented out.
  • Assumes no restrictive constraints in MySQL that hinder direct migration.

Contributing

Contributions for improvements or new features are welcome. Feel free to fork and submit pull requests.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0