SeaQL / sea-orm

🐚 An async & dynamic ORM for Rust
https://www.sea-ql.org/SeaORM/
Apache License 2.0
6.56k stars 459 forks source link

sea-orm-cli hard codes schema #2235

Open DenuxPlays opened 1 month ago

DenuxPlays commented 1 month ago

Description

When using the sea-orm-cli like this:

sea-orm-cli generate entity -o entity/src/new \
    --lib \
    --with-copy-enums \
    --with-serde both \
    --date-time-crate time\
    -u postgresql://docker:root@localhost:5432/docker

Sea-orm generates something like this:

#[sea_orm(schema_name = "public", table_name = "account")]

Hard coded schema name is generally not a good idea as the user maybe want to use a different schema. Also there is already the DATABASE_SCHEMA env var that would become obsolete.

Steps to Reproduce

  1. execute the command above
  2. see the hard coded schema

Expected Behavior

Just do not generate the schema like before. Generate this instead:

#[sea_orm(table_name = "account")]

Actual Behavior

Generates this:

#[sea_orm(schema_name = "public", table_name = "account")]

Reproduces How Often

Every time

Workarounds

Just remove it afterwards

Reproducible Example

https://github.com/financrr/financrr-app/tree/main/backend

Versions

v1.0.0-rc.4