PostgreSQL → MySQL
Convert PostgreSQL enum types to MySQL ENUM
PostgreSQL enums are named types shared across tables; MySQL enums are inline per-column. The labels and values survive, the type definition just moves into the table.
CREATE TYPE … AS ENUM → ENUM(...)
What to know
- Each enum-typed column becomes ENUM('label1','label2',…) with identical labels
- Label order (and therefore sorting) is preserved
- Adding a label later: ALTER TABLE … MODIFY COLUMN with the extended list
- If several tables shared one type, each now has its own copy — keep them in sync
Before / after
PostgreSQL
CREATE TYPE mood AS ENUM ('happy','neutral','sad');
mood mood DEFAULT 'happy' MySQL
mood ENUM('happy','neutral','sad') DEFAULT 'happy' 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 PostgreSQL → MySQL converterSee the full type mapping table or all guides.