MySQL to PostgreSQL Schema Converter
Convert MySQL CREATE TABLE statements to PostgreSQL: AUTO_INCREMENT to identity, TINYINT(1) to BOOLEAN, ENUM to CHECK, KEY to CREATE INDEX and FULLTEXT to GIN.
Free · No sign-up · Your inputs stay in your browser
Input
Convert MySQL CREATE TABLE to PostgreSQL
Output
PostgreSQL DDL
1 table, 1 to review
AUTO_INCREMENT becomes an identity column, TINYINT(1) BOOLEAN, DATETIME TIMESTAMP, TIMESTAMP TIMESTAMPTZ, JSON JSONB, ENUM a TEXT column with a CHECK, inline KEYs separate CREATE INDEX statements and FULLTEXT a GIN index over to_tsvector. Data does not move with the schema: pgloader does both for a real migration.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
The mappings that need thought
PostgreSQL has no unsigned integers, so BIGINT UNSIGNED becomes NUMERIC(20) unless you know the values fit in BIGINT. TIMESTAMP becomes TIMESTAMPTZ, which stores an absolute instant; DATETIME becomes TIMESTAMP without a zone, matching MySQL's behaviour. JSON becomes JSONB, which is indexable but drops duplicate keys and key order.
Schema is the easy half
Moving the data, rewriting MySQL-specific SQL (backtick quoting, LIMIT x, y, GROUP BY looseness, IFNULL) and testing the application is most of a migration. pgloader moves schema and data in one pass and is the usual tool for the whole job.