Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discovering Postgres enum #22

Closed
tyt2y3 opened this issue Nov 3, 2021 · 1 comment · Fixed by #24
Closed

Discovering Postgres enum #22

tyt2y3 opened this issue Nov 3, 2021 · 1 comment · Fixed by #24

Comments

@tyt2y3
Copy link
Member

tyt2y3 commented Nov 3, 2021

So to support SeaQL/sea-orm#252

We need to properly discover Postgres enums from a given schema (MySQL enum is done already)

For example, given a schema:

CREATE TYPE mpaa_rating AS ENUM (
'G',
'PG',
'PG-13',
'R',
'NC-17'
);

We want to query the enum definition from information_schema and then output a TypeCreateStatement in the end:

Type::create()
    .as_enum(Alias::new("mpaa_rating"))
    .values(vec![
        "G",
        "PG",
        "PG-13",
        "R",
        "NC-17",
    ])

https://github.com/SeaQL/sea-query/blob/HEAD/src/extension/postgres/types.rs

We may need to add new data structures to the def module too.

Once we got the writer done, we can transform that in SeaORM inside the codegen.

@tyt2y3
Copy link
Member Author

tyt2y3 commented Nov 3, 2021

@charleschege

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants