sea-orm-cli hard codes schema
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 9.9k
- Forks
- 734
- Avg merge
- 6h 36m
- Merged PRs (30d)
- 8
Description
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
- execute the command above
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the sea-orm-cli generate entity command from the report against PostgreSQL and inspect the generated entity attribute. Trace the CLI's entity-generation path to find where schema_name = "public" is emitted. Done means generated entities use only table_name = "account" as shown in the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, rust
- Domain
- cli, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100