MySQL → PostgreSQL
Convert MySQL ENUM to PostgreSQL enum types
Both engines support enums, but PostgreSQL enums are standalone named types rather than inline column definitions, so each MySQL ENUM column gets its own CREATE TYPE.
ENUM → CREATE TYPE … AS ENUM
What to know
- A PostgreSQL enum type is created per column with identical labels
- Values migrate unchanged; invalid empty-string values ('') become NULL
- Adding labels later: ALTER TYPE … ADD VALUE
- Alternative mapping: text + CHECK constraint, if you prefer flexibility over strictness
Before / after
MySQL
CREATE TABLE users (
status ENUM('active','banned','pending') DEFAULT 'pending'
); PostgreSQL
CREATE TYPE users_status AS ENUM ('active','banned','pending');
CREATE TABLE users (
status users_status DEFAULT 'pending'
); Don't convert column-by-column — convert the whole database.
Upload a dump, get back ready-to-import SQL with this mapping (and every other one) applied.
Open the MySQL → PostgreSQL converterSee the full type mapping table or all guides.