PostgreSQL to MariaDB Migration CLI. Migration of INSERT queries is not supported at this time.
- Read the PostgreSQL dump file line by line.
- If the line is empty, output a blank line and go to the next line.
- If the line starts with
SET
, do not output and go to the next line. - If the line starts with
SELECT pg_catalog.set
, do not output and go to the next line. - Delete the
public
schema. - Delete the PostgreSQL cast operator (::type name).
- Replace PostgreSQL data types with MariaDB data types.
- Replace the
to_hex
function in PostgreSQL with thehex
function in MariaDB. - Replace
ALTER TABLE ONLY
syntax withALTER TABLE
. - Replace PostgreSQL's
SEQUENCE
-based numbering process with MariaDB's numbering process. - Replaces the
CREATE INDEX
syntax.ON table_name USING btree
movesUSING btree
beforeON
. - Output converted line.
- Replace the primary key constrained column type of type
text
withvarchar(768)
inside theCREATE TABLE
statement. - Replaces the type of a column defined as a foreign key destination inside a
CREATE TABLE
statement with the type of the foreign key source.
npm install -g postgresql2mariadb
Output MariaDB schema based on PostgreSQL schema.
npx postgresql2mariadb -i sample/postgresql_schema.sql -o sample/mariadb_schema.sql
Options:
- -i, --in <filepath>: Input file path (PostgreSQL dump).
- -o, --out <filepath>: Output file path (MariaDB dump).
- -d, --debug: Debug mode. Default is false.
- -h, --help: display help for command
npx postgresql2mariadb -h
https://takuya-motoshima.github.io/postgresql2mariadb/
With npm do:
npm test
Takuya Motoshima