Open biruburu opened 2 weeks ago
It looks like cargo loco db entities
failed to add a number of generated entities to src/models/mod.rs
. Adding them to mod.rs manually makes it compile.
I guess the bug here lies in why they are not being added to mod.rs.
Let me know how I can help debug this!
Description
I have an existing postgresql schema that I wish to "uplift" into loco. Using regular sea-orm-cli (without loco), I am able to successfully generate entities using the following command:
I can then compile and use the generated entities as expected.
To Reproduce
When I try to use
cargo loco db entities
instead ofsea-orm-cli
, the entities get generated. However, compilation fails with:To Reproduce
cargo install loco-cli
loco new --path loco --name test --db postgres --template saas --assets serverside
cd loco/test
config/development.yaml
to point to a moderately complex postgres database that was not generated via lococargo loco db entities
cargo build
Expected Behavior
The entities get generated and
cargo build
succeeds.Environment:
This is a fresh installation of
loco==0.12.0
on MacOS 15.0.1 usingrustc --version
1.81.0. I am using postgresql 15.x, and tried sea-orm-cli 1.0.1, 1.1.0, 1.1.1 (all work fine when used directly.)Additional Context
Edit: the issue seems to be that
cargo loco db entities
skips certain models when generatingmodels/mod.rs
(see first comment below). There does not seem to be anything different between these models and the ones that are actually generated:Original:
I tried passingcargo loco db entities --with-serde both --serde-skip-deserializing-primary-key --expanded-format
, but received anargument --with-serde not recognized
error.Those arguments seem to be required for mysea-orm-cli
entities to work. Is there a way to pass them or configurecargo loco db entities
to use them?