zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
29.38k stars 3.97k forks source link

Postgresql unsupported database type: uuid #3303

Open jin-yuzhe opened 1 year ago

jin-yuzhe commented 1 year ago

I encountered an error while using goctl to generate a PostgreSQL model. The error message states "unsupported database type: uuid." I am currently using goctl version 1.5.2. I kindly request support for this data type. Thank you very much.

Yuuuuuukit commented 1 year ago

hei guys, have you found a way?

waltcow commented 1 year ago

anyone have solution here??

AndrewAlizaga commented 1 year ago

I'm gonna take a look at this if nobody minds, @jin-yuzhe could you provide more details about the issue so I can replicate it?

localrivet commented 1 year ago

@AndrewAlizaga, this feature would be nice to have.

Here's how to replicate this issue:

Using Postgres (I'm running Postgres 12), install the extension uuid-ossp.

CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

Then, create a table using the extension:

CREATE TABLE table_1(
    id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
    email varchar(255) NULL,
    created_at timestamp DEFAULT CURRENT_TIMESTAMP
);

Generate the model:

goctl model pg datasource -url="postgres://postgres:postgres@localhost:5432/testdb?connect_timeout=180&sslmode=disable" --schema="public" -style go_zero -table="test_1" -d ./internal/models

Produces the following:

Error: unsupported database type: uuid

Using goctl --version goctl version 1.5.3 darwin/arm64

AndrewAlizaga commented 1 year ago

@localrivet on it

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically. πŸ‘―πŸ‘­πŸ»πŸ§‘β€πŸ€β€πŸ§‘πŸ‘«πŸ§‘πŸΏβ€πŸ€β€πŸ§‘πŸ»πŸ‘©πŸΎβ€πŸ€β€πŸ‘¨πŸΏπŸ‘¬πŸΏ


@localrivet on it

dacsang97 commented 9 months ago

I believe the uuid data type is quite popular with Postgres. Please consider providing support for it soon. I apologize for mentioning and bothering you @kevwan. Thank you.