Postgres enum in typeorm

前端 未结 4 1167
南笙
南笙 2021-02-18 18:49

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 TABL         


        
4条回答
  •  星月不相逢
    2021-02-18 19:32

    For Postgres, the column type should be 'text', not 'string', as string results in DataTypeNotSupportedError: Data type "string" in "" is not supported by "postgres" database.

提交回复
热议问题