When generating migration SQL, pgschema produces types in the following canonical format:
Copy
-- ENUM type with no valuesCREATE TYPE [schema.]type_name AS ENUM ();-- ENUM type with values (multi-line format)CREATE TYPE [schema.]type_name AS ENUM ( 'value1', 'value2', 'value3');-- Composite type (single line)CREATE TYPE [schema.]type_name AS (attribute1 data_type, attribute2 data_type);
Key characteristics of the canonical format:
Uses single-line format for empty enums
Uses multi-line format with indentation for enums with values
Each enum value is on its own indented line for readability
No comma after the last enum value
Composite types use single-line format with attributes separated by commas
For DROP operations: DROP TYPE IF EXISTS type_name RESTRICT;
ENUM types can be modified by adding values with ALTER TYPE type_name ADD VALUE 'new_value' AFTER 'existing_value';
Note: Composite type modifications in pgschema currently require dropping and recreating the type, as PostgreSQL has limited ALTER TYPE support for composite types and complex dependencies make in-place modifications challenging.