In TypeORM, how can I create a postgres enum type Gender as in this raw query
CREATE TYPE public.Gender AS ENUM (
'male', 'female'
);
ALTER TABLE public.person ALTER COLUMN gender TYPE public.gender USING gender::gender;
and use it in the Entity class?
I have tried
@Entity()
export class Person {
@Column('enum')
gender: 'male' | 'female'
}
but obviously this isn't the right way, since I got the error message "type enum does not exist".
I don't want to use typescript enum either, since it will give me a bunch of 0s and 1s in the database.