SeaQL / seaography

🧭 GraphQL framework for SeaORM
Apache License 2.0
375 stars 35 forks source link

GraphQl query with postgress enums #139

Open vlccek opened 1 year ago

vlccek commented 1 year ago

Description

Generating project with seaography-cli from postgress db. When I try to get data from the table with an enum, the server panic.

Steps to Reproduce

  1. Create a table with postgress enum
  2. Try to query some data from that table from graphql interface.

Versions

├── sea-orm v0.10.7
│   ├── sea-orm-macros v0.10.7 (proc-macro)
│   ├── sea-query v0.27.2
│   │   ├── sea-query-derive v0.2.0 (proc-macro)
│   ├── sea-query-binder v0.2.2
│   │   ├── sea-query v0.27.2 (*)
│   ├── sea-strum v0.23.0
│   │   └── sea-strum_macros v0.23.0 (proc-macro)
├── seaography v0.3.0
│   ├── sea-orm v0.10.7 (*)
│   └── seaography-derive v0.3.0 (proc-macro)

Additional Information

Server output:

Rust type `core::option::Option<alloc::string::String>` (as SQL type `TEXT`) is not compatible with SQL type `_foodcategoryenum`" }))

Problematic column:

    #[sea_orm(column_type = "Custom(\"array\".to_owned())", nullable)]
    pub category: Option<String>,

I even try to replace this definition by

 pub category: Option<Vec<Foodcategoryenum>>,

but it will not compile because

the trait `From<Vec<Foodcategoryenum>>` is not implemented for `sea_orm::Value`
karatakis commented 1 year ago

Thanks for taking the time to report this issue. I will schedule it to be delivered in later versions.