Skip to content

ostark/pg-converter

Repository files navigation

PG Converter

PG Converter is a command-line utility crafted to simplify the process of converting PostgreSQL dumps into dumps compatible with MySQL.

While the SQL grammar of both database engines shares similarities, there are distinctions in certain areas. This tool specifically focuses on converting SQL statements generated by pg_dump, which include commands for creating tables, indexes, constraints, and inserting data.

State of the project (2024-03-05)

If you discover this repository by accident, you will notice the tool is not ready to use. But you can look around and help with bug reports, PRs are appreciated too! Supported (pg_dump) statements so far:

  1. CREATE TABLE
  2. CREATE INDEX
  3. ALTER SEQUENCE
  4. ALTER TABLE ONLY
  5. COPY

Example

php bin/pg-convert 
    <src> Postgres source file
    <target> Mysql target file
    --filterInput="^CREATE INDEX searchindex_keywords_idx"
    --appendString="CREATE FULLTEXT INDEX keywords_idx ON searchindex(keywords);"

TODOs

  • e2e tests
  • integration tests

This package is inspired by a Perl script by Tim Sehn, and it is based on the wonderful PHP Skeleton by Nuno Maduro.

About

Postgres to Mysql dump converter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages