go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

goctl generate model with postgresql engine unsupported enum data type.

Open bomb-bomb opened this issue 2 years ago • 3 comments

So what should we do temporarily ?

"status" "oauth"."user_status" DEFAULT 'normal'::oauth.user_status, CREATE INDEX "users_status_k" ON "oauth"."users" USING btree ( "status" "pg_catalog"."enum_ops" ASC NULLS LAST );

bomb-bomb avatar Jun 29 '23 03:06 bomb-bomb

Can you please provide a specific data type or table definition?

kesonan avatar Jun 29 '23 07:06 kesonan

Hi there @kesonan ! I had the same issue. And I can provide an example of this. goctl command usage is below:

goctl model pg datasource -url="postgres://user:[email protected]:5454/database?sslmode=disable" --schema="public" -style go_zero --table="videos" --dir ./models

Video table definition:

create table videos
(
    id                     bigserial
        primary key,
    title                  varchar(255)                                                not null,
    description            text                      default ''::text                  not null,
    thumbnails             jsonb                     default '{}'::jsonb               not null,
    duration               bigint,
    process_type           video_process_type_enum,
    process_status         video_process_status_enum default 'pending'::video_process_status_enum,
    process_exception      varchar(255)              default ''::character varying,
    created_at             timestamp(0)              default now()                     not null,
    deleted_at             timestamp(0),
    access_type            content_access_type_enum  default 'opened'::content_access_type_enum
);

Custom enum type definition:

CREATE TYPE video_process_type_enum AS ENUM ('download', 'transcode', 'upload');

Error message:

unsupported database type: video_process_type_enum

goctl command doesn't recognize custom enum types of database. how can i resolve this issue for datasource model generation ?

Thanks in advance.

Hudayberdyyev avatar Sep 01 '23 12:09 Hudayberdyyev

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Sep 04 '24 01:09 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Dec 06 '24 02:12 github-actions[bot]